Question

I recently upgraded from Snow Leopard to Mountain Lion, which seems to have erased of all of my Python packages. I would like to reinstall them to system Python (2.6), but any method I choose (source/easy_install/port) wants to install to 2.7. Sometimes I can just drag the egg files into the proper directory and it works, but sometimes it doesn't.

Supposedly, Python 2.6 is active. Why do easy_install and port want to use 2.7, and how can I fix it?

$ python
Python 2.6.7 (r267:88850, Oct 11 2012, 20:15:00)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin

$ sudo port select python
Available versions for python:
    base.mp_1382830518
    none
    none.mp_1382830518
    python25-apple
    python25-apple.mp_1382830518
    python26
    python26-apple (active)
    python26-apple.mp_1382830518
    python27
    python27-apple
    python27-apple.mp_1382830518
Was it helpful?

Solution

My Macports provides different easy_install command for each Python:

 [~]% easy_install
 easy_install      easy_install-2.5  easy_install-2.6  easy_install-2.7  easy_install-3.2

However never use easy_install against a system Python. Always use virtualenv and you can avoid problems like system update wipes your Python environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top