Edit: Read Ned Deily's answer before you read this one
1.
On my system I have different easy_install script for each python version:
- /usr/bin/easy_install-2.5
- /usr/bin/easy_install-2.6
The contents of the 2.6 version looks like this:
#!/System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
import sys
sys.argv[0] = sys.argv[0].replace('-2.6', '')
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==0.6c9','console_scripts','easy_install'
__requires__ = 'setuptools==0.6c9'
import sys
from pkg_resources import load_entry_point
sys.exit(
load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
)
Now, if you not already have those scripts on you machine, you could create those by using the above as template. Just change the first line so it points to the right python interpreter. Probably something like:
#!/sw/bin/python23
And change the third line to match the current script name; meaning, if the script is called easy_install-2.3, then it should look like this:
sys.argv[0] = sys.argv[0].replace('-2.3', '')
And of course if you are not using setuptools version 0.6c9 than you will have to change this, too.
An alternative is to run the easy_install script as an argument of the right python version. Like this:
$ python23 /some/path/easy_install networkx-0.36-py2.5.egg
2.
Each python version has a different site-lib, so they are independent from each other. You can install different modules and versions for different python versions
3.
You could make the env variable PYTHONPATH point to a common directory or add a common directory to sys.path in your scripts. But be aware that some modules work only with certain python versions and include C code that has to be compiled for each python version...