问题
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!
回答1:
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 about lib-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).
回答2:
to skip this message in pydev you can create manual symbolic links to stdlib not linked by virtualenv.
Example:
ln -s /usr/lib/python3.3/threading.py /home/path/to/virtual/myenv/lib/python3.3/threading.py
ln -s /usr/lib/python3.3/traceback.py /home/path/to/virtual/myenv/lib/python3.3/traceback.py
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/
来源:https://stackoverflow.com/questions/6615629/eclipse-pydev-error-python-stdlib-not-found