tags:

views:

34

answers:

2

I am trying to install dateutils on OS X 10.6. When I run python setup.py install it installs fine but to the Python 2.6 directory. I need to use Python 2.5 which is the "default" python version. By this I mean that when I run python from the command line it loads Python 2.5.4.

Is there a way to install modules to specific versions of Python. I have not had a problem like this before as normally it installs to the version of Python I have set as default.

A: 

What version of Mac OS X are you using, what is your PATH, and did you install the other version of Python using MacPython, or did you install it via MacPorts? On Mac OS X 10.6 Snow Leopard, the following command works just fine at installing dateutils in the system's version of Python.

sudo easy_install -O2 dateutils

Note, though, that if your second installation of Python also has a copy of the setuptools installed, and if that version's easy_install utility overshadows the default in the PATH, then this will install to the other Python.

Michael Aaron Safyan
I am using 10.6.2. I think I installed 2.6 from python.orgmy path is below/opt/subversion/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/binin /usr/bin python is the 2.5.4 versionUsing easy_install also installs to 2.6Installed /Library/Python/2.6/site-packages/pytz-2010h-py2.6.egg
Robert
@Robert, python2.6 is the default version of Python on Mac OS X 10.6. You probably have an alias such as "python=python2.5" which is causing 2.5 to be loaded as the default. You might want to look into that.
Michael Aaron Safyan
@Robert, while you could install dateutils in the manner suggested by krawyoti, I suggest you get the system back to normal and make 2.6 the default again.... 2.6 is backwards compatible with 2.5, but there are a lot of additions in 2.6 that you don't get with 2.5, and also that would greatly simplify installation of other libraries (e.g using easy_install).
Michael Aaron Safyan
Unfortunately, I am using a module Pybel (http://openbabel.org/wiki/Python) which for some reason does not import in 2.6 I have now found out that it is not 2.6 but the fact that python 2.6 is 64bit. Setting it in 32 bit mode seems to work. Thanks for your help.
Robert
A: 

Typically you should have the also a python2.5 in the path:

python2.5 setup.py install
krawyoti