7
1
I have both Python 2.7 and Python 3.3 installed on my machine (I'm on Windows 8).
I would like .py files to be opened with Python 3.3 by default. The only Python path in the PATH environment variable is the 3.3 one. Still, when opening .py files I see they're being interpreted by Python 2.7, even when I explicitly open them with the Python 3.3 exe ("Open with" and choosing the 3.3 exe). I've also tried changing the Python.exe version using "Set Associations" in Windows' control panel. I'm not sure it has changed anything. No matter what I do, the output of the following program is 2.7.3
:
import sys
print(sys.version)
How do I force Windows 8 to open .py files with Python 3.3?
How do you open them? By double clicking? Are they executed right away in a console window, or got picked up by IDE (i.e. IDLE)? – None – 2013-06-12T19:51:12.880
@J0HN: I open them by double clicking and they're being opened with a console window. I've also tried right clicking and choosing "open with" with the 3.3 version. – snakile – 2013-06-12T19:52:21.650
launch interactive interpreter by typing just
python
in console, than run the code from the question. If it still output 2.7.3 your path points to the wrong python interpreter. Or, even better, just typepython -V
in console – None – 2013-06-12T19:53:50.460@J0HN: Thanks, both your suggestions do work and output 3.3 as desired. But even when I start the .py file using Windows command line shell it outputs 2.7. – snakile – 2013-06-12T19:57:21.390
haven't used python in windows for years but check these env-variables:
%PATH%
,%PYTHONPATH%
. Have a look atmsconfig
and autoexec.bat. – Fredrik Pihl – 2013-06-12T19:57:48.027@FredrikPihl: I don't have a PYTHONPATH variable. The PATH variable contains the Python 3.3 path. What do I have to look for in msconfig? What is autoexec.bat? – snakile – 2013-06-12T20:00:45.877
perhaps you can find something interesting here http://docs.python.org/3/using/windows.html
– Fredrik Pihl – 2013-06-12T20:27:32.077