0

When I type which python, I get the following result:

/Library/Frameworks/Python.framework/Versions/Current/bin/python

when I type "type -a python":

python is /Library/Frameworks/Python.framework/Versions/Current/bin/python python is /Library/Frameworks/Python.framework/Versions/2.6/bin/python python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python python is /Library/Frameworks/Python.framework/Versions/Current/bin/python python is /usr/bin/python python is /usr/local/bin/python

I want to use python 2.5, which I have installed!

But at this point, I'm a bit confused, and I don't know how to set that as default, or what path I should be using.

Please note, I am developing SPECIFICALLY for Google App Engine, so please keep that in mind.

Thanks in advance.

2 Answers 2

2

If you install Python 2.5 from python.org (specifically this dmg file), it can make a link for you into /usr/local/bin/python. Once you do that, and ensure /usr/local/bin is in your $PATH environment variable, then /usr/local/bin/python should be exactly what you want. To verify, try at a Terminal.app shell prompt...:

$ python -V
Python 2.5.4

this should confirm that 2.5.4 is the default Python. Also:

$ /usr/bin/env python -V

(since /usr/bin/env is what app engine is specifically using) should confirm the same result.

As an aside, it's very correct on your part to want to ensure you're using Python 2.5 for app engine purposes -- using 2.6 or 2.7 would give some occasional strange results, and, worse, would accept some code (using post-2.5 features) that then would not run on Google's app engine servers (which are using 2.5).

Sign up to request clarification or add additional context in comments.

3 Comments

When I type python -V, i do get "Python 2.5.4", and also for /usr/bin/env python -V, but I'm still getting an issue using easy_install where it is choosing python 2.6 :/ should I remove that/how do i change easy_install path?
You need to have a separate easy_install for each version of Python you want to use. If you are using the Apple-supplied python 2.5 in OS X 10.6, you'll find a /usr/bin/easy_install-2.5 for it. If you installed python 2.5 for OS X from python.org, follow the instructions for either setuptools (pypi.python.org/pypi/setuptools) or Distribute (pypi.python.org/pypi/distribute). Either one will put an easy_install in /Library/Frameworks/Python.framework/Versions/2.5/bin which you should put at the front of your shell PATH.
GoogleAppEngineLauncher seems to want to use python 2.6 under Snow Leopard by default. You can make it use 2.5 by explicitly setting /usr/local/bin/python2.5 i the Preferences; note that the UI is really horrible and you need to hit Enter in the dialog box despite the absence of an OK button.
0

The easiest way I found to use GAE SDK is to install Mac port ( http://www.macports.org/ ) and from there the different version of python (2.5 and 2.7).

Once installed:

$ sudo port install python25  # To install python 2.5
$ sudo port install python27  # To install python 2.7

Then from Googleappenginelauncher menu, open Preferences and put /opt/local/bin/python2.5 or /opt/local/bin/python2.7 in the Python path field.

To install PIL or lxml for example just type these commands in a shell:

 # For PIL and python 2.7
 $ sudo port install py27-pil

 # For Lxml and python 2.7
 $ sudo port install py27-lxml

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.