Federer
Federer

Reputation: 34745

Setting Python Interpreter in Eclipse (Mac)

How do I direct Eclipse to the Python interpreter on my Mac?

I've looked in Library which contains the directory 'Python' then '2.3' and '2.5', however they contain nothing except 'Site-packages' - Which is weird considering I can go into the terminal and type python. I then installed the latest 2.6 version with package manager and still can't find it. Can anyone help?

Upvotes: 10

Views: 21818

Answers (4)

Rmahajan
Rmahajan

Reputation: 1361

If you have installed python on mac, follow belows steps (on eclipse neon)

  1. Click on Preferences
  2. Search for python
  3. Below screen will appear

    enter image description here

  4. Click Choose from list enter image description here

  5. It will show up all the python installed and select one for you

Hope it helps some one. It resolve my problem.

Upvotes: 1

eb80
eb80

Reputation: 4738

I just solved this for my Mac and it was located in

/usr/bin/python2.7

The way I found it is as follows:

(1) I tried entering the following to see if I could find where Python was located

echo $PYTHONPATH

This had the location of a custom install of Python that came from another program I downloaded, but I wanted the native Python.

(2) I wanted to see every folder in the path so I could look for python

echo $PATH

This returned the following:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/sbin

(2b) I CDed into every one of these locations and searched for python in each one.

cd /usr/bin/
ls | grep "python"

And I eventually found Python.

In Eclipse, with PyDev, if you (1) click Preferences (2) PyDev (3) Interpreter - Python, you can add the interpreter.

Upvotes: 2

Shailesh Kumar
Shailesh Kumar

Reputation: 6967

Running $which python should help locate your Python installation.

Upvotes: 7

Ned Deily
Ned Deily

Reputation: 85055

An alias to the python interpreter was likely installed into /usr/local/bin. So, to invoke python2.6, type /usr/local/bin/python2.6 or, most likely, just python2.6. If you want python to invoke python2.6, try rearranging your $PATH so that /usr/local/bin precedes /usr/bin.

Upvotes: 7

Related Questions