PyDev Eclipse Python 解释器错误:找不到 stdlib
我一直在尝试使用 Eclipse 3.6 作为 Python 编辑器。 我安装了最新版本的 PyDev,然后尝试在我的 Mac 上设置首选项的 Interpreter - Python 字段。
我的python版本是2.6,路径是“/usr/bin/python”。当我输入此内容并选择要添加到系统 PYTHONPATH 的项目时,我收到以下错误消息:
错误:找不到 Python stdlib
似乎 Python /Lib 文件夹(其中包含标准 在安装过程中未找到/选择库)。
此文件夹(其中包含 threading.py 和 Traceback.py)是 PyDev 正常运行所必需的(并且它必须 包含实际的源文件,而不仅仅是 .pyc 文件)...
所以我不能告诉 Eclipse 解释器路径! 任何帮助都会很棒! (我已经尝试重新安装 PyDev,但没有成功)
谢谢!
按照 Praveen 的回答,我的 python 库位于 /library/python/2.6/site-packages 中。当我在解释器字段中输入 /usr/bin/python 时,Eclipse 会询问我想要将哪些路径添加到系统 PYTHONPATH 中。复选框项目之一正是该路径。所以我把它和其他框一起检查。单击“确定”,我收到同样的错误。
I have been trying to use Eclipse 3.6 as a Python editor.
I install the latest version of PyDev, and then try to set the Interpreter - Python field of the preferences, on my mac.
My python version is 2.6 and the path is "/usr/bin/python". When I enter this, and I select the items to add to the system PYTHONPATH I get the following error message:
Error: Python stdlib not found
It seems that the Python /Lib folder (which contains the standard
library) was not found /selected during the instal process.This folder (which contains files such as threading.py and
traceback.py) is required for PyDev to function properly (and it must
contain the actual source files, not only .pyc files) ...
So I can't tell eclipse the interpreter path!
Any help would be great!
(I tried reinstalling PyDev already, no luck)
Thanks!
Following Praveen's answer, My python library is in /library/python/2.6/site-packages. When I enter /usr/bin/python into the interpreter field, eclipse asks me which paths I would like to add to my System PYTHONPATH. One of the checkbox items is exactly that path. So I check it, along with the other boxes. Click ok, and I get the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(13)
有同样的问题。使用默认安装的 python (2.6),Eclipse 无法找到所有必需的路径。我下载了 python 2.7,并进行了安装。我的新“which python”路径变成:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python。
当我这次尝试设置解释器时,指定了这条路径,它就顺利通过了。
注意:
/Library/Frameworks/Python.framework/Versions/2.7/bin
目录,Had the same problem. Eclipse wouldn't find all the required path using the default installed python (2.6). I downloaded python 2.7, went through the install. My new "which python" path became:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python.
When I tried to set up the interpreter this time, specified this path and it went right through.
Note:
/Library/Frameworks/Python.framework/Versions/2.7/bin
directory刚刚找到了我自己问题的答案,认为它可能会启发其他有类似问题的用户。稍后我会尝试一下,看看是否有效。
在 SourceForge 上: http://sourceforge.net/projects/pydev/forums/ forum/293649/topic/4480085:
“我下载了 Python 源代码版本,然后将 /Lib 文件夹放入 /System/..../Frameworks/.../lib/python2 .6/ 并且它有效。”
“这是一个解决方案(尽管我在 Mac OS 上所做的通常是从 python.org 安装 python,而不是使用默认的安装——不确定如果在开发过程中出现问题,Mac OS 中可能会出现问题) ”。
just found an answer to my own question, thought it might enlighten other users with similar problems. I will try it out later to see if it works.
On SourceForge: http://sourceforge.net/projects/pydev/forums/forum/293649/topic/4480085:
"I downloaded the Python source release and simply dropped the /Lib folder into the /System/..../Frameworks/.../lib/python2.6/ and it works."
"That's a solution (although usually what I do on Mac OS is getting a python install from python.org instead of using the default one -- not sure what you may break in Mac OS if something bad happens there while developing)."
当我升级到 Mountain Lion (10.8.2) 时,我遇到了这个问题。解决办法是安装XCode 4.5.2,然后在XCode >首选项>组件,有一个安装命令行工具的选项。我安装了它们,然后我就可以安装解释器了。
When I upgraded to Mountain Lion (10.8.2) I had this problem. The solution was to install XCode 4.5.2, then in XCode > Preferences > Components, there is an option to install the Command Line Tools. I installed them and then I was able install Interpreter.
PyDev 需要 python lib 文件夹的位置才能获取计算机上的此目录位置,请尝试在终端中运行此命令。
并将该目录添加到 Eclipse 中 PyDev 中的 PYTHONPATH 位置。
PyDev needs the location of the python lib folder to get this directory location on your computer try running this command in the terminal.
And add that directory to your PYTHONPATH location in PyDev in Eclipse.
对于 OS X 10.8 (Mountain Lion),我在这里找到了一个解决方案: pydev 调试器:在 OS 10.8 升级后无法找到 python 2.7 的真实位置
似乎默认没有安装命令行工具,所以你必须去下载它们...
For OS X 10.8 (Mountain Lion) I found a solution here: pydev debugger: unable to find real location for python 2.7 after OS 10.8 upgrade
Seems that there are no command line tools installed by default, so you have to go download them...
我也遇到了错误:找不到 stdlib 源。
我的修复方法是安装 XCode 4.2,然后重试 Eclipse 的 PyDev“自动配置”方法。
没有错误。 PyDev 运行正常!
I too had the error: stdlib sources not found.
My fix was to install XCode 4.2 and then retry Eclipse's PyDev "Auto Config" method.
No error. PyDev running OK!
我找到了不接触macs提供的python版本的解决方案,但是
在设置解释器时下载广告安装一个新版本(当前是3.something),指向/usr/local/bin/pyhton3
(以找出打开终端的确切路径并输入: sudo -s !hittenter> 你的密码 !hittenter> cd /usr/local/bin !hittenter> ls !hittenter>)
->其作用是向您显示您访问的文件夹的内容。你应该在那里找到 python 解释器。
警告!!!!
请勿触摸或更改 Mac 附带的任何其他 Python 文件/文件夹。
I found the solution of not touching macs deliverd python version, but downloading ad installing a new one (currently 3.something)
when setting up the interpreter, point to /usr/local/bin/pyhton3
(to find out the exact path open terminal and type: sudo -s !hittenter> your password !hittenter> cd /usr/local/bin !hittenter> ls !hittenter>)
-> what this does is, showing you the content of the folder you went to. you should find the python interpreter in there.
WARNING!!!!
Do not touch or change any other python files/folders delivered with your mac.
从 http://developer.apple.com/xcode/ 安装 Apple 的 OSX 开发人员工具后, .py 文件将安装在 /library/python/2.6/site-packages 中。无需大惊小怪自己安装 python 或使用未经 Apple 支持的 Python 版本。
After installing Apple's OSX Developer tools from http://developer.apple.com/xcode/, the necessary .py files will be installed in /library/python/2.6/site-packages. No need to fuss with installing python yourself of using versions of Python not blessed by Apple.
@labjunky ,如果源 tar 球中 lib 文件夹中的 .py 文件被放入用户的 site-packages 文件夹 ~/Library/Python/2.7/lib/python/site-packages[ ,前提是它在位置中列出PyDev 和 selected] ,它也有效。如果用户无权修改 /System/Library/Frameworks/... 中的位置,这可能会很有用。
@labjunky , if the .py files from the lib folder in the source tar ball are dropped into the User's site-packages folder ~/Library/Python/2.7/lib/python/site-packages[ provided it is listed in the locations by PyDev and selected] , it works too. this can be useful if the user does not have permission to modify the location in /System/Library/Frameworks/....
在首选项> PyDev >解释器 - Python
然后自动配置一些路径,选择它们,然后继续。
In Preferences > PyDev > Interpreter - Python
it then auto-configs some paths, select them, and it proceeds.
我在设置 Jython 时遇到了这个问题,并按照此处所述解决了它:https://stackoverflow.com/a/20002281/1915920
I had this issue setting up Jython and solved it as described here: https://stackoverflow.com/a/20002281/1915920
我决定保留 MAC OS Python 2.7 不变,而只安装 Python 3.3.4。
运行起来很顺利! :)
1) 下载 python 3.3.4:
python-3.3.4-macosx10.6.dmg 来自 http://python.org/download/releases/3.3.4/:
“从适用于 Mac OS X 10.6 及更高版本的 Mac OS X 64 位/32 位安装程序 (3.3.4)”下载(我的 Mac 操作系统是 Mountain Lion)。
2) 设置 Python 解释器和 Lib:
转到 Eclipse Preferences >翻译> Python解释器并单击“快速自动配置”。它能够找到Python 3.3.4,找到解释器为 /usr/local/bin/python3 (实际上是: shulow$ ls -l /usr/local/bin/python3
lrwxr-xr-x 1根轮69 4 Mar 23:18 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3)
并且它还会自动在 /Library/Frameworks/Python.framework/Versions/3.3/lib/python3 中查找相应的库.3 包含 .py 文件(而不仅仅是 .pyc 和 .pyo)
I decided to leave my MAC OS Python 2.7 as is, and instead just install Python 3.3.4.
It works smoothly! :)
1) download python 3.3.4:
The python-3.3.4-macosx10.6.dmg is from http://python.org/download/releases/3.3.4/:
downloaded "from Mac OS X 64-bit/32-bit Installer (3.3.4) for Mac OS X 10.6 and later" (My Mac OS is Mountain Lion).
2) setup Python Interpreter and Lib:
Go to Eclipse Preferences > Interpreter > Python Interpreter and click "Quick Auto Config". It is able to locate the Python 3.3.4, find the interpreter as /usr/local/bin/python3 (which is actually: shulow$ ls -l /usr/local/bin/python3
lrwxr-xr-x 1 root wheel 69 4 Mar 23:18 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/python3)
And it also automatically find the respective libraries in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3 which has the .py files (rather than only the .pyc and .pyo)
我收到此错误是因为我下载了 Python 的嵌入式 zip 文件版本并将其解压到文件夹中。然后我下载了实际的安装程序并运行它。这给了我我所缺少的东西。
I got this error because I downloaded the embedded zip file version of Python and extracted it to a folder. I then downloaded the actual installer and ran it. That gave me the stuff that I was missing.