Configuring Pydev Interpreter in Eclipse to use En

2019-02-06 01:01发布

I downloaded Pydev plugin for Eclipse (3.5.2) today on Mac OSX 10.5.8. To be able to use Pydev, I need to configure the interpreter in Eclipse. I am not clear what exactly I need to do here, or what this step does. I want to make sure that when I run programs from Eclipse using Pydev, it uses the Enthought Python Distribution (EPD) I have installed, and can use all the packages that come with EPD. Can someone please tell me simple steps that I need to follow.

If I click on autoconfig, it shows a bunch of folders with the path

/System/Library/Frameworks/Python.Framework/Versions/2.5/...

But I know that the Python that came with EPD is version 2.6.4, so autoconfig is not choosing EPD.

Thanks for any help.


UPDATE - solution

If anyone else is interested in learning how to do this, see the first link in the answer by mlvljr below. Use the solution there EXCEPT that as suggested in the solution, Shift+Cmd+G, did not help me see inside the Python.app package. To look inside it, use the "gear" drop down menu in the Finder and choose "Show Package Contents"

7条回答
成全新的幸福
2楼-- · 2019-02-06 01:18

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!

查看更多
登录 后发表回答