Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have python 2.7 installed

[user@localhost google_appengine]$ python  
Python 2.7 (r27:82500, Sep 16 2010, 18:03:06)   
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2  
Type "help", "copyright", "credits" or "license" for more information.

I want to use the python 2.5.2 that is in this directory

[user@localhost Downloads]$ ls |grep "Python-2*"  
Python-2.5.2
Python-2.5.2.tgz

to run a python script in Khan Academy platform against a google app engine application

sudo python sample_data.py -a ~/workspace/GAE/google_appengine/appcfg.py upload

Currently, when running the last script 2.7 python complains a lot (Google App Engine runs on 2.5.2 mostly and 2.6 almost)

I would like to do something like

sudo python env set ~/Downloads/Python-2.5.2 sample_data.py -a ~/workspace/GAE/google_appengine/appcfg.py upload  

Is this possible? If yes, please point the way. If not, please suggest a way to call python2.5.2 WITHOUT having to uninstall python 2.7

many many thanks
Dennis

share|improve this question

1 Answer 1

If you have the Python 2.5.2 installed or the binaries, just use the full path to the binary:

sudo ~/Downloads/python

instead of sudo python

Without providing the full path, you are running the binary that bash finds on the $PATH environment variable.

Also check this documentation, specially the part about $PYTHONHOME and $PYTHONPATH

share|improve this answer
1  
I don't know Python, but you may have to have PYTHON_HOME or something similar set before execution, and maybe even a PATH change. All pretty simple, especially if you do this in a short script, but you may need to track down multiple references. –  mpez0 Mar 7 '11 at 14:29
    
Thanks @mpez I edited my answer including the environment vars. –  coredump Mar 7 '11 at 15:24

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.