I installed both Python2 and Python3 on my computer, but if I run a Python script, my computer choose to use Python2. I tried to uninstall Python2, but it turned out that my computer could not run Python anymore if I do so. How can I do to upgrade to Python 3?
Asked
Active
Viewed 361 times
-1
-
1go to python's website and download the 3.6.x installer – mast3rd3mon May 23 '18 at 15:05
-
2I believe this has been answered already. By using 'shebang' you can specify which python interpreter to use. https://stackoverflow.com/questions/6908143/should-i-put-shebang-in-python-scripts-and-what-form-should-it-take – Stanton May 23 '18 at 15:06
-
Since you have `py` installed, you can control what it does by default by setting the `PY_PYTHON` environment variable. For example, on a Windows the command line type `set PY_PYTHON=3`. – martineau May 23 '18 at 15:32
2 Answers
0
You can't upgrade from Python 2 to 3. You need to change executable completely.
Probably when you installed Python 2, Python 3 was replaced in PATH to the location where Python 2 was located. Therefore you should update the PATH variable to include the location for Python 3.

Xantium
- 11,201
- 10
- 62
- 89
0
Can not update. You can intall python3 as next folder in your pc. And you can use python3 when run python .py script file. And just change your python.exe to python3.exe in python3 of folder.

P113305A009D8M
- 344
- 1
- 4
- 13