Configuring Pydev Interpreter in Eclipse to use Enthought Python Distribution

戏子无情 提交于 2019-11-30 08:24:25

At least on Windows, this seems to doable via:

  1. [Navigate Eclipse menus] "Window"->"Preferences"->"PyDev"->"Interpreter - Python"-> "New" (which is next to "Auto Config" you tried to use, if I get it right)

  2. [Type or paste into textboxes] "Interpreter Name", "Interpreter Executable"

  3. Click "OK" :))

[UPDATE]

From the Enthought Python Distribution Readme.txt (EPD.mkpg/Contents/Resources/Readme.txt in epd-6.1-1-macosx-i386.dmg EPD disk 32-bit MacOS disk image):

Applications are installed into /Applications/EPD32-6.1
and the underlying Python framework into /Library/Frameworks/Python.framework/Versions/6.1

So, Interpreter Executable must be:

/Library/Frameworks/Python.framework/Versions/6.1/python

You can supply (almost) any Interpreter Name you like. :)

Hope this helps.

[EDIT]

If this does not help, google search for “Error getting info on interpreter” gives the following (the problem may have to do with Eclipse version (older have bugs) and the symlink vs actual path problem):

  1. Installing PyDev on OS X 10.5.2

  2. [Pydev-users] [pydev - Users] mayapy on PyDev Maya Python is running on OSX

  3. Cannot set python interperter in preferences - ID: 1523582 (unfold "comments" there)

Mac OS 10.6.4:

Selecting the interpreter as /Library/Frameworks/Python.framework/Versions/2.7/Python did not work.

I had to select /Library/Frameworks/Python.framework/Versions/2.7/bin/python

For latest versions of Canopy under Mac the correct path seems to be:

/Users/<yourusername>/Library/Enthought/Canopy_32bit/System/bin/python

I tried with ~/.... first but Eclipse didn't seem to like that.

Marc Pou

I've had the same luck!

On top of a Mac X Lion I did the following installations: * Enthought 2.7 (these preconfigures Python 2.7 and a lot of other libraries). * Aptana Studio 3.03 (not beta) with PyDev preconfigured. * Finally, and after some troubles I saw that there was some versions of Python installed on my Mac (and I don't remembre when I installed it). I had to choose the version that justus87 says. Put attention on it because its easy to confuse and is a head break!

Remember, the path of the python file is: /Library/Frameworks/Python.framework/Versions/7.1/bin/python

You need to make sure you point it to the EPD interpreter and not just the regular python 2.7 interpreter. For EPD 7.2 64-bit on mac the path is "/Library/Frameworks/EPD64.framework/Versions/7.2/bin"

I am running Python 3, so I had to make these changes to get python.exe as my interpreter.

File: C:\EasyEclipse-for-LAMP-1.2.2.2\extensions\pydev-1.3.3\eclipse\plugins\org.python.pydev_1.3.3\PySrc\interpreterInfo.py

Edit all occurrences of "print ..." to "print(...)" (the ... is whatever is being printed), so wrap it in parentheses.

Comment out line 16, since True and False are considered keywords in Python 3.

Save, and you should be able to successfully set C:\Python32\python.exe as the interpreter. I kept the default folders checked.

I found this tutorial very helpful for this problem - http://www.cs.duke.edu/courses/compsci101/current/resources/install.php

Specifically, step 6:

  1. connect Eclipse to your version of Python (so you can run Python programs within Eclipse) connect Eclipse to your version of Python (so you can run Python programs within Eclipse)
    • open Eclipse and access the Preferences Box (under Window>Preferences on Windows or Eclipse>Preferences on Mac)
    • choose "Pydev" and "Interpreter - Python" from the sidebar
    • press the "New ..." button to tell Eclipse about Python
    • in the resulting dialog box, for the "Interpreter Name" type "Canopy" and for the "Interpreter Executable" type
      • for Windows: "C:\Users\UUU\AppData\Local\Enthought\Canopy\User\python.exe"
      • for Mac: "/Users/UUU/Library/Enthought/Canopy_VVV/User/bin/python"
    • where UUU is your user name on your machine and VVV is the remainder of the directory name (which depends on which version you installed; you should be able to find the right one by browsing to it)
    • choose "Select All" and then click "OK" at the bottom of the resulting dialog box
    • click "OK" at the bottom of the Preferences Box and wait for the changes to take effect when the dialog box to close (you do not need to restart Eclipse)

If you can get the (Enthought) Canopy distribution working, but are unsure where it's installed to/what PyDev needs, the following worked for me to use that install to identify the right solution, and install it:

start ipython (as it was installed with the Canopy distribution).

do:

import sys; 
for i in sys.path: print( i)

look for the option that ends in: "/bin" ( e.g. mine was: /Users/myUserNameHERE/Library/Enthought/Canopy_32bit/User/bin )

Now the fun part (as it worked for me), go to eclipse's preferences, and under: "Pydev"==> "Interpreter - Python", and select 'New...'

Add in that full path under 'Interpreter Executable" put that path, along with 'python' (on mac [ probably 'python.exe' on windows?] ). For 'Interpreter Name' I put 'Python2.7-Canopy');

PyDev then automatically the other libraries to include ( I checked the boxes to accept its suggestions).

Lastly, you'll need to make sure that your project is using that Interpreter. Ensure either

  • (a) If your project is bound to the default interpreter (for 'Python' and not 'Jython'), move that new 'Python2.7-Canopy' you added (in your workspace Preferences) to be your workspace's default ( using 'Up' to make it first) or
  • (b) Go to the settings for the project, and under 'PyDev - Interpreter/Grammer' select from the requisite dropdown box the name you put (eg. "Python2.7-Canopy")

On my system, all then finally worked, matplotlib, numpy, etc. Yeah!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!