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'm using built-in Python 2.6.1, however, I need to run Python 3.0 from time to time.

  • Is it OK to install Python 3.0 on my Mac? Is there anything that I need to be cautious?
  • How about the easy_install? If I have 2.6 and 3.0 on my Mac, where to the library for easy_install is installed?
  • Is there any easy way to make python point to 2.6 or 3.0?
share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

There are several ways to install Python and which way affects the later answers. In all cases you should install a later Python 3 version - 3.1.3 is the latest released version. For choosing which to run I would call python3.1 or python2.6 to be explicit as the language differs enough that the code is specific to the 2.x or 3.x branches. In fact much code starts with the #!/usr/bin/env python line but is 2.x specific. I would say that having the python executable on your path being linked to python3.1 would be a problem Apple scripts that use python always look for /usr/bin/python so will always find the Apple version and not a properly installed other version.

easy_install is from an external package setuptools and you can tell setup.py where to put it.

Simplest is install from the python.org installer This will give a python3 executable in /usr/local/bin (and possibly python as well). In this case I would create a python symbolic link in ~/bin (pointing to the apple python or python3 and you can switch where it points as you require without sudo which a link in /usr/local/bin would require.
In this case I think easy_install for python3 will by default end up in /usr/local/bin and the apple one is in /usr/bin

I use macports versions and they install in /opt/local and have a script port select that will switch /opt/local/bin/python between the 3.1 or 2.6 versions (or any others you have installed) - unfortunately not does not do this for easy_install which is in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin (or 3.1 etc)

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.