I currently have Python 3.4 as my default Python version, but I want to set Python 2.7 as the default one temporarily.
I'm on Windows 7 and my Python scripts are run using the Python Windows launcher. The documentation says I can customize it by creating a py.ini
file, but that doesn't work. I created a file with these contents:
[defaults]
python=2.7
I've tried placing it in the same folder as the file I'm running, I tried placing it in C:\Users\Administrator\
, in C:\Users\Administrator\AppData\
and in C:\Users\Administrator\AppData\Local\
, but none of these worked. The launcher still uses Python 3.4. (Both when I double-click the file in the Windows UI and both when I launch the launcher directly, like py my_file.py
.)
Why is the Python Windows launcher ignoring my py.ini
file?
Here's the output from running py age.py
with the environment variable PYLAUNCH_DEBUG
set:
launcher build: 32bit
launcher executable: Console
Using local configuration file 'C:\Users\Administrator\AppData\Local\py.ini'
File 'C:\Windows\py.ini' non-existent
Called with command line: age.py
maybe_handle_shebang: read 256 bytes
maybe_handle_shebang: BOM not found, using UTF-8
parse_shebang: found command: python
searching PATH for python executable
Python on path: C:\python34\python.EXE
located python on PATH: C:\python34\python.EXE
run_child: about to run 'C:\python34\python.EXE age.py'
Traceback (most recent call last):
File "age.py", line 17, in <module>
name = raw_input("Enter a person's name to check their age: ")
NameError: name 'raw_input' is not defined
child process exit code: 1