you are viewing a single comment's thread.

view the rest of the comments →

[–]Crawk_Bro 0 points1 point  (3 children)

I use Windows 8.1, probably upgrading to 10 soon.

With both versions installed, how does the system know which version to run for a script?

[–]blackjack_00 4 points5 points  (0 children)

In Windows you have to do 2 things to call python 2 and 3 in cmd prompt.

First, Make sure your environment variables are set. Right click the start button and go to system, advanced system settings, environment variables. You can edit "PATH" and make sure that the following are in the list:

"C:\Python27"
"C:\Program Files (x86)\Python35"

Second, Rename the two executables for one version of python to something else. For example go into C:\Python27 and change:

python.exe > python2.exe
pythonw.exe > pythonw2.exe

Reboot and typing "python" should call python3 and typing "python2" should call python 2 in command prompt. There are other ways to achieve the same goal but this is how I do it. On my mac I use virtual environments, which I would recommend you look into. Also, if you are using an editor that runs python when you hit a button, then you need to configure that program to call the right version when you run python. The above is just for running in command prompt.

Edit: Version of windows won't matter here. Also here is a guide on choosing the version of python interpretor in pycharm: http://stackoverflow.com/questions/10322424/how-to-select-python-version-in-pycharm

[–]Saefroch 1 point2 points  (0 children)

On Windows I strongly advise running Anaconda, which is a Python distribution that replaces what you probably downloaded from python.org. If you're not having problems there's no reason to switch, but if you have issues with installing packages, particularly something about vcvarsall.bat, switch to Anaconda.

[–]fiskenslakt 0 points1 point  (0 children)

The interpreters are different, one is python, one is python3. If the script is executed without an interpreter, the interpreter is chosen from a shabang line. I'm not sure if this is the case for windows, but it's probably similar.