Eclipse Pydev:“错误:找不到 Python stdlib”
我正在尝试向 PyDev 添加解释器(使用 virtualenv 创建),但出现以下错误:
似乎是Python /Lib文件夹 (其中包含标准库) 期间未找到/选择 安装过程。
此文件夹(其中包含诸如 如 threading.py 和traceback.py)是 PyDev 运行所需的 正确地(并且它必须包含 实际的源文件,不仅仅是 .pyc 文件)...
请注意,如果这是一个 virtualenv 安装,从基础的 /Lib 文件夹 需要选择安装(与 站点包是 可选)...
问题是我的默认安装下没有 /lib 文件夹...我使用“no-site-packages”选项创建了 virtualenv...我该如何解决?谢谢!
I am trying to add an interpreter (created using virtualenv) to PyDev but I get the following error:
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) ...Note that if this is a virtualenv
install, the /Lib folder from the base
install needs to be selected (unlike
the site-packages which is
optional)...
The problem is that there is no /lib folder under my default installation... I created the virtualenv with the 'no-site-packages' option... How can I solve? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要在 pydev 中跳过此消息,您可以创建指向未由 virtualenv 链接的 stdlib 的手动符号链接。
示例:
virtualenv 中有很多未链接的 stdlib。也许你应该根据需要手动制作。
查看 /usr/lib/python3.3 并与 /home/path/to/virtual/myenv/lib/python3.3 进行比较
您可以在 pydev 中添加,例如 /usr/lib/python3.3/concurrent/小路。
如果您按照 Bhaduri 先生的建议添加 /usr/lib/python2.7 (或 /usr/lib/python3.3),您可以爆炸您的 virtualenv,因为您的包可以查看 /usr/lib/python2 中的 site-packages 目录.7 这正是你不想要的。
您想要隔离您的环境。您希望您的包仅在 /home/path/to/virtual/myenv/lib/python3.3/site-packages/ 中查看
to skip this message in pydev you can create manual symbolic links to stdlib not linked by virtualenv.
Example:
There is a lot of stdlib not linked in virtualenv. Probably you should make as you need manualy.
Look at /usr/lib/python3.3 and compare with /home/path/to/virtual/myenv/lib/python3.3
You can add, per example, /usr/lib/python3.3/concurrent/ in your pydev path.
if you add /usr/lib/python2.7 (or /usr/lib/python3.3) as suggest by Mr. Bhaduri you can explode your virtualenv because your package could look at site-packages directory in /usr/lib/python2.7 and this is exactly what you dont want.
You want isolate your enviroment. You want your package look only in /home/path/to/virtual/myenv/lib/python3.3/site-packages/
我自己以前也遇到过这种情况。在 PyDev 中添加使用 virtualenv 创建的解释器时,当它询问需要添加到 SYSTEM pythonpath 的文件夹时,我必须选择
/usr/lib/python2.7
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/plat-linux2
请参阅屏幕截图了解我必须做什么。这里
temp
是我的 virtualenv。即使添加了系统Python目录,PyDev也没有获取全局站点包,所以你仍然达到“无站点包”的效果。我假设您必须在 Windows 上执行类似的操作,即选择“选择所需”对话框中的所有文件夹,包括 C:\Pythonx.x 文件夹。
编辑:我刚刚在 Eclipse Indigo(带有 virtualenv 1.7 的 Arch Linux)上使用 PyDev 2.3 进行了尝试,似乎不需要选择
plat-linux2
(不是确定lib-tk
,但/usr/lib/python2.7
肯定是必需的)。感谢 fijiaaron 指出这一点。编辑2:Pydev 2.5(也可能是2.6,来自文档)仍然需要
/Lib
文件夹才能正常运行,尽管它现在允许您忽略“Python stdlib not found”对话框并添加解释器(但提到它仍然需要稍后包含)。I've come across this myself before. When adding an interpreter created using virtualenv in PyDev, when it asks for the folders that need to be added to the SYSTEM pythonpath, I had to select
/usr/lib/python2.7
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/plat-linux2
See the screenshot for what I had to do. Here
temp
is my virtualenv.Even though the system Python directory was added, PyDev did not pick up the global site packages, so you still achieve the "no-site-packages" effect. I'm assuming you would have to do something similar on Windows i.e. select all the folder in the "Select Needed" dialog, including the
C:\Pythonx.x
folder.EDIT: I just tried it out with PyDev 2.3 on Eclipse Indigo (Arch Linux with virtualenv 1.7), and it seems that
plat-linux2
does not need to be selected (not sure aboutlib-tk
, but/usr/lib/python2.7
is definitely required). Thanks fijiaaron for pointing it out.EDIT 2: Pydev 2.5 (and probably 2.6 too, from the docs) still requires the
/Lib
folder to function properly, though it now lets you ignore the "Python stdlib not found" dialog and add the interpreter anyway (but mentions that it still needs to be included later).