Search code examples
pythontox

Testing a python script in a specific version


I currently have Python 2.6.2 installed on my mac. I am writing a script which MUST run on Python 2.5.2. So I want to write a python script, and test is specifically against 2.5.2 and NOT 2.6.2.

I was looking at virtualenv, but it doesn't seem to solve my problem. I ran python virtualenv.py TEST which made a TEST dir, but it had python 2.6 in it. Is there a way to make virtualenv use a different version of python than what's installed default on my machine? Is another way to use the #! as the first line of the python script? How would I do that?


Solution

  • You could just install a Python 2.5.2.

    I have 3 different versions Python installed on my Lucid and they use different links under /bin/ so it's easy to call the specific version

    python -> python3 ->python3.1
    python2 -> python2.7
    python2.5