views:

70

answers:

3

I've been learning Python for a couple of weeks, and although I've been successfully develop apps for Google App Engine with Python 2.6.5, it specifically requires Python 2.5.

Being mindful of compatibility issues when uploading apps (it's a situation I'd rather avoid while learning Python), I wonder if it's possible to have 2.5 and 2.6.5 installed on the same machine. Ideally I'd like to use 2.6.5 as the default, and configure GAE to somehow use 2.5.

A: 

Yes, it is possible to install multiple versions of Python "side-by-side". On Ubuntu, you simply install with

sudo apt-get install python2.5

(On the current version of Ubuntu, 10.04, python2.6 comes installed by default.) To use python 2.6, just call python or /usr/bin/python. To use python 2.5, you call /usr/bin/python2.5.

If you tell us your operating system, we may be able to provide more relevant details.

Another possibility is to use virtualenv.

unutbu
I'm so sorry. I'm using Windows 7 Ultimate not Linux. I knew there was something I forgot to mention.
Lost
+4  A: 

Absolutely.

If you're on *nix, you'd usually just use make altinstall instead of make install, that way the "python" binary won't get installed/overwritten, but instead you'd have e.g. python2.5 or python2.6 installed. Using a separate --prefix with the configure script is also an option, of course.

Some Linux distributions will have multiple versions available via their package managers. They'll similarly be installed as python2.5 etc. (With the distribution's blessed/native version also installed as the regular python binary.)

Windows users generally just install to different directories.

Nicholas Knight
I just mentioned to ~unutbu that I forgot to mention I'm using Windows, so maybe it really is as simple as you say. Presumably I install Python in two different directories, and point PYTHONPATH at at the 2.6.5 installation. But is it possible to point GAE at the older version to ensure it only uses 2.5?
Lost
@Lost: I assume you're talking about the GAE development appserver. You just need to run it using the Python 2.5 binary. There shouldn't be anything to "point" GAE at, aside from PYTHONPATH if you need it.
Nicholas Knight
Right. I'm currently running the GAE development appserver with 2.6.5 and it just works. I didn't have to do any configuring. I assumed that installing Python 2.5 alongside 2.6.5 would cause a problem with GAE. I'll go ahead and do it anyway and see what happens. Thanks.
Lost
A: 

OK, I figured out the answer to my own question, partly with the help of Nicholas Knight who pointed out that you just install different Python version to different Python directories. I was left scratching my head on how to get Google App Engine to use Python 2.5 (the required version) instead of Python 2.6. This is the answer:

1) Install Python 2.5. 2) Install Python 2.6 (or a more recent version), afterwards. This will be the system default. 3) Install the Google App Engine SDK. 4) Launch, "Google App Engine Launcher" from the Start Menu 5) Click Edit > Preferences, and enter the path to the pythonw.exe executable. Usually c:\Python25\pythonw.exe

Lost