Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I recently asked if I should upgrade python 2.6 to python 2.71 on my Mac (Snow Leopard). I was told to install 2.7 without removing 2.6. Done!

Now I was wondering how the installation of new modules is handled:

Does both 2.6 and 2.7 access the same place where all new python modules are installed by pip, easy_install and setup.py? Is there something I have to take care of?

Another question occured to me: How do I tell a script that I have written to be run by python 2.7.2?

share|improve this question
    
I have used virtual_env in the past to create virtual environments. The nice thing about doing it this way, is that you can use 2.6 in one v_env and 2.7 (with/without certain modules) in another. Check it out. –  Harv Jul 18 '11 at 0:10
add comment

1 Answer

up vote 1 down vote accepted

Install of python modules goes in x/Library/FrameworksPython.framework/Versions/2.6 etc where x depends on the install.

nothing for the one from Apple as port of OSX. python executable in /usr/bin

nothing for pythons from python.org. python executable in /usr/local/bin

/opt/local if installed via macports (as I do)

You have to look at easy_install etc to see the path to the python they use. e.g. /usr/bin/easy_install has /usr/bin/python so using this will install in /Library/FrameworksPython.framework/Versions/2.6.

You cannot choose to run under a minor version of python e.g. 2.7.2 as only one major version at a time is set up normally e.g. 2.7.2 replaced 2.7.1 Each major version of python will have its own executable e.g. python2.7 s to have a script use that verstio make it begin with #!/usr/bin/env python2.7 pr the full path.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.