I'm using windows xp.
I'm trying to use Python in powershell. On my computer I have both Python 3.3 and 2.7 installed. I'm trying to run 2.7 but whenever I type "python" into powershell it opens 3.3.
How do I select the version of Python to run?
make a batch file to launch it called python. bat in a folder in the PATH ahead of other versions. make an alias (in your PS Profile) named python to launch the one you want ( New-Alias -name python -Value C:\Python27\python.exe , etc).
Go to This PC → Right-click → Click on Properties → Advanced System Settings. You will see the System Properties. From here navigate to the Advanced Tab -> Click on Environment Variables. You will see a top half for the user variables and the bottom half for System variables.
The default Python interpreter is referenced on Windows using the command py. Using the Command Prompt, you can use the -V option to print out the version. You can also specify the version of Python you'd like to run. For Windows, you can just provide an option like -2.7 to run version 2.7.
In powershell, enter the following:
$Env:PY_PYTHON = 2
Then try using the command "py". It should start up Python 2.7. If you ever want to run Python 3.3 again, "py -3" will do the trick.
Something like Python Select? Windows support is experimental but it might be worth a try.
https://github.com/Activestate/pythonselect
There's also switchpy, although that only supports up to Python 3.2.
apipes.blogspot.com/2010/10/switchpy.html?m=1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With