25

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.

13 Answers 13

28

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:

  1. Browse to /Library/Frameworks/Python.framework/Versions/2.7/bin directory
  2. Select the python interpreter that's installed. Sometimes the 'python' link doesn't exist to the current interpreter (say, python3)
2
  • 2
    For Mac newbies like me, maybe it is useful to point out that there is a Library folder in two places 1) As jgtaylor123 points out, the one under root or 'Macintosh HD' 2) The one under System ( where I mistakenly was trying to get it working)
    – RAbraham
    May 28, 2012 at 12:58
  • This stumped me this morning. Thanks for the quick fix!
    – Federer
    Oct 18, 2012 at 10:22
7

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:

  • tim-erwin writes:

"I downloaded the Python source release and simply dropped the /Lib folder into the /System/..../Frameworks/.../lib/python2.6/ and it works."

  • fabioz writes:

"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)."

7

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.

5

PyDev needs the location of the python lib folder to get this directory location on your computer try running this command in the terminal.

python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"

And add that directory to your PYTHONPATH location in PyDev in Eclipse.

4

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...

3

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!

1
  • 3
    there is no need to install the entire xcode toolkit. installing the command line tool (it is part of xcode) is sufficent to get the python source files.
    – linqu
    Aug 27, 2012 at 16:22
2

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.

2

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.

2
  • I have Xcode 4 installed but I still get the error described in the original question. Can you specify which version of Xcode you used? Thanks!
    – pm_labs
    Jul 17, 2011 at 8:41
  • I'm not even totally up to date. I'm using 3.2.6.
    – Adam V.
    Aug 18, 2011 at 21:38
2

@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/....

1

In Preferences > PyDev > Interpreter - Python

  • Choose New...
  • Name it "Python2.7"
  • set the path to /usr/bin/python

it then auto-configs some paths, select them, and it proceeds.

1

I had this issue setting up Jython and solved it as described here: https://stackoverflow.com/a/20002281/1915920

1

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)

0

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.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 18, 2021 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.