I have this issue where I installed python 3.9 and python 3.10. I want to run some .py file in python 3.9, so naturally I choose open with and browse to python 3.9 .exe file. But for some reasons, it opens up the python.exe from python3.10 folder. Here's the directory:C:\Users\user\AppData\Local\Programs\Python\Python39. But it always opens up python.exe from this directory: C:\Users\user\AppData\Local\Programs\Python\Python310.
Asked
Active
Viewed 106 times
2 Answers
1
Try using py.exe (Python Launcher for Windows).
C:\>py -0p
Installed Pythons found by py Launcher for Windows
-3.10-64 C:\Users\xyz\AppData\Local\Programs\Python\Python310\python.exe *
-3.9-64 C:\Users\xyz\AppData\Local\Programs\Python\Python39\python.exe
# You have 3.10 as the default, if you want to use non-default version:
C:\>py -3.9-64 your_script.py

Thy
- 468
- 3
- 5
1
Use the absolute path for the python version you want to execute or you can specify the version you want to run. It is done as follow.
py -version file.py

Amrit Pangeni
- 41
- 1
- 5