如何在 OSX Lion 上的 Eclipse 中配置 PyDev 以使用 32 位 Python 解释器

发布于 2025-01-04 16:59:24 字数 582 浏览 5 评论 0原文

我正在运行 OSX Lion 并已从 python.org 安装了 python2.7(该发行版可以在 64 位和 32 位模式下运行)。我还安装了 wxPython 包。我可以通过显式使用 32 位 版本来运行从终端导入 wxPython 的 python 脚本。我想在 Eclipse 中运行相同的脚本,但不能。我将 PyDev 配置为使用 python.org 的解释器,但它默认为 64 位(我通过打印 sys.maxint 进行检查)。我不知道如何让 PyDev 使用 32 位解释器。 我尝试将 PyDev python 解释器配置为指向:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32

但最终使用:

/Library/Frameworks/Python.framework/Versions/2.7 /Resources/Python.app/Contents/MacOS/Python

如何配置 PyDev 以在 OSX Lion 上的 Eclipse 中使用 32 位 python 解释器?

我感谢任何有关此事的意见。谢谢。

I am running OSX Lion and have installed python2.7 from python.org (this distribution can run in both 64bit and 32bit mode). I have also installed the wxPython package. I can run python scripts that import wxPython from the Terminal by explicitly using the 32-bit version. I would like to run the same scripts in Eclipse, but cannot. I configure PyDev to use python.org's interpreter, but it defaults to 64-bit (I check this by printing sys.maxint). I cannot figure out how to make PyDev use the 32-bit interpreter.
I have tried configuring the PyDev python interpreter to point to:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32

but it ends up using:

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

How can I configure PyDev to use the 32-bit python interpreter in Eclipse on OSX Lion?

I appreciate any input regarding this matter. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月无声 2025-01-11 16:59:24

PyDev 中使用的解释器是根据 sys.executable 计算的...

现在,有一个疑问:如果您使用 /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32 启动 shell 并执行 'print sys .executable',出现哪个可执行文件?

现在,解决方法...您可以尝试替换plugins/org.python.pydev/PySrc/interpreterInfo.py中出现sys.executable的位置以指向'/Library/Frameworks/Python.framework/Versions/2.7/ bin/python2.7-32'

这是决定实际使用哪个解释器的脚本...(不过,奇怪的是 sys.executable 会指向不同的解释器) 地点...)

The interpreter used in PyDev is computed from sys.executable...

Now, a doubt: if you start a shell with /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32 and do 'print sys.executable', which executable appears?

Now, onto a workaround... you can try replacing the places where sys.executable appears in plugins/org.python.pydev/PySrc/interpreterInfo.py to point to '/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32'

That's the script where it decides which interpreter to actually use... (still, it's strange that sys.executable would point to a different location...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文