mascai
mascai

Reputation: 1872

How to run python3 from cmd.exe

I see the following text when I type python in my Windows 8.1 console (cmd.exe)

Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AM D64)] on win32

I want to run python3.6 version when I type python.

What I tried

1) Entered python3 and python3.6, but I didn't work

2) downloaded python3 and added it to the PATH variable

C:\Users\alex\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\alex\AppData\Local\Programs\Python\Python38-32\;C:\Users\alex\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\alex\AppData\Local\Programs\Python\Python36\;C:\Program Files\Java\jdk1.8.0_91\bin; c:\Go\bin; ;%PyCharm%; C:\Users\alex\Desktop\Education\5\dev\chrome;;C:\Program Files\gretl;C:\chromedriver;C:\chromium-automation;C:\Users\alex\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.6;

Upvotes: 1

Views: 837

Answers (2)

Amit Naidu
Amit Naidu

Reputation: 2648

You can use the python launcher with the py -3 or py -3.6 command to explicitly invoke python3.

The path you posted is not your complete path. It is just the user path. The system path takes precedence over it and has python2 in it. You can uninstall python2 to fix this. Or if you want to keep it, uninstall and reinstall python 3.6 remembering to choose the Add Python to PATH checkbox in the installer.

Upvotes: 1

CanciuCostin
CanciuCostin

Reputation: 1908

You need to remove python 2 installation directory from PATH before adding python 3 directory to PATH.

Upvotes: 1

Related Questions