0

Possible Duplicate:
Powershell Python: Change version used

I have both python 2.7 and 3.3 installed on my machine (windows). Say I want to switch back and forth between them; how do I write a script that will set change the path variable so I can switch back and forth easily without doing in manually?

Community
  • 1
  • 1
spitfiredd
  • 2,897
  • 5
  • 32
  • 75
  • 1
    Just in case you don't know about it, check out [virtualenv](http://pypi.python.org/pypi/virtualenv), which is a tool which allows you to create isolated Python environments, so you can easily use multiple different versions of Python on the same system. – Chris Nov 12 '12 at 16:30

2 Answers2

0

Rather than change the path variable, it would probably be better to remove them both from your path and symlink the one you want to use in some common folder you have in your path (like /usr/local/bin). It would then be very simple to write a script to switch back and forth between them. Just remove the symlink and do ln -s again.

Edit: Disregard; see linked duplicate answer for a better solution.

jonvuri
  • 5,738
  • 3
  • 24
  • 32
0
import sys
sys.path.remove('<path to 2.7>')
sys.path.append('<path to 3.3>')

and vice-versa

Cameron Sparr
  • 3,925
  • 2
  • 22
  • 31