5

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.

Robert
  • 181
  • 1
  • 3
  • 9

3 Answers3

5
pip install python-dateutil

Answer from this question asking for the same thing but for Windows: How to install python-dateutil on Windows?

Community
  • 1
  • 1
Santiago Angel
  • 1,127
  • 15
  • 19
1

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
  • 93,612
  • 16
  • 138
  • 200
  • I am using 10.6.2. I think I installed 2.6 from python.org my path is below /opt/subversion/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin in /usr/bin python is the 2.5.4 version Using easy_install also installs to 2.6 Installed /Library/Python/2.6/site-packages/pytz-2010h-py2.6.egg – Robert Apr 23 '10 at 11:13
  • @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 Apr 23 '10 at 12:29
  • @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 Apr 23 '10 at 12:35
  • 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 Apr 23 '10 at 14:52
0

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

python2.5 setup.py install
krawyoti
  • 19,695
  • 1
  • 23
  • 17