I have python 2.6.6 and python 3.1.3 currently installed on my machine (Windows Vista 64 bit) My path variable includes the directory of both versions. How can I specify which python I want to run a program in. For instance, if I want to run a program in python 3, it works but if I want to run a different program in python2 I get a syntax error. So how can I run a python 2 program in the cmd?
Typing python in my command line, python 3.1.3 is the only one that shows up.
We can convert Python2 scripts to Python3 scripts by using 2to3 module. It changes Python2 syntax to Python3 syntax. We can change all the files in a particular folder from python2 to python3.
you can install both python 2 and python 3 in your machine but you can not use both in single code editor in same time. To use both at same time you have to open one IDEs with python 2 and another IDEs with python 3.
Python 2.6 includes many capabilities that make it easier to write code that works on both 2.6 and 3. As a result, you can program in Python 2 but using certain Python 3 extensions... and the resulting code works on both.
Python 3 is not backwards compatible with Python 2, so your code may need to be adapted. Please start migrating your existing your existing Python 2 code to Python 3. Python 2 series End Of Life is set to 1st of January 2020.
Instead of just typing "python" on the command line, use the full path the python.exe that you want to run: FULL_PATH_TO_PYTHON_2.6.6\python.exe or FULL_PATH_TO_PYTHON_3.1.3\python.exe should distinguish between the two.
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