

bat files can be called from the cmd directly without using their extension. You can create an alias for the Python3 executable called python3.bat. You will no longer be able to install external packages and modules. But, pip will no longer work if you change the name of the original python executable. But you have to use python3 file.py or python3 -version, which I think, is understandable. You might think, changing the name of python.exe to python3.exe for the Python3 executable will solve your problem.

Therefore, every time you type python in your cmd, it runs Python2.īoth Python2 and Python3 executables have the same name in Windows so it never runs python3. Which means, it gets the path to Python2 before it can get to the path of Python3. It searches for an executable with the same name in the directory the cmd has been opened in, then goes and searches for the command in the locations provided in the Windows PATH variable, from TOP to BOTTOM. As you can see, the path of Python2 is placed above the path of Python3 in my system. I hope you know that the path of the python executable has to be added to the PATH environment variable in Windows.

As you can see, I have both Python2 and Python3 installed.
