Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

easy_install with various versions of python installed, mac osx

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)
like image 946
juanchopanza Avatar asked Apr 26 '11 14:04

juanchopanza


People also ask

Can I have multiple versions of Python installed on Mac?

With pyenv you can install multiple Python versions on your machine and easily switch between them. Note: this article is geared towards Mac users, and especially Apple Silicon Mac users. Linux users might benefit from the pyenv tutorial, but Windows users are out of luck — pyenv does not officially support Windows.

Can I have 2 versions of Python installed?

If you wish to use multiple versions of Python on a single machine, then pyenv is a commonly used tool to install and switch between versions. This is not to be confused with the previously mentioned depreciated pyvenv script. It does not come bundled with Python and must be installed separately.


2 Answers

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)

like image 65
myusuf3 Avatar answered Sep 28 '22 07:09

myusuf3


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

like image 28
Erik Avatar answered Sep 28 '22 09:09

Erik