11

I have various versions of python on a mac OSX 10.6 machine, some of them installed with macports:

> python_select -l
Available versions:
current none python24 python26 python26-apple python27

The default or system version is python26-apple. I am now using python27, which I selected with

> sudo python_select python27

I recently tried installing django using easy_install, but it got installed with the default python (I can check that by python_selecting python26-apple and importing django). If, instead, I download the django tarball, expand and use

> sudo python setup.py install

everything works as expected, i.e. I get django in python 2.7. Now the question is, is there a way to get easy_install to work with the version of python I have selected with python_select?

UPDATE Apparently python_select is deprecated. The following command seems to be equivalent:

port select --list python

producing:

Available versions for python:
    none
    python24
    python26
    python26-apple
    python27 (active)
juanchopanza
  • 223,364
  • 34
  • 402
  • 480

2 Answers2

9

If you want your "easy_install" match your updated python version, follow these steps:

Download the corresponding .egg file at http://pypi.python.org/pypi/setuptools#files Run it as if it were a shell script: sh setuptools-0.6c9-py2.7.egg This will install the new "easy_install" executable, compatible with your current version of python.

Hope this helps.

(more details at http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other)

Mahdi Yusuf
  • 19,931
  • 26
  • 72
  • 101
  • Thanks, that worked fine. The only glitch was that I had to add `script-dir /usr/bin` to get the new easy_install in the PATH. Also, if I select python26-apple again, I have to remember to use `easy_install-2.6` since `easy_install` is now bound to python 2.7. But I can live with that! – juanchopanza Apr 26 '11 at 15:15
  • i am sad to find out that this is the way to get easy_install-2.7 onto an Amazon Linux instance. Would have been nicer to yum install it. – jrwren Jan 30 '13 at 20:05
  • that's not easy at all! – Michael May 02 '14 at 21:56
1

Be sure to use the -prefix= option on that shell script to control where your easy_install version lands.

Erik
  • 7,479
  • 8
  • 62
  • 99