In Windows, running the python3
command might give you the following error:
'python3' is not recognized as an internal
or external command, operable program or batch file
This error occurs because the python3
alias is only created by default in Linux-based OS like Ubuntu and macOS.
For Windows OS, the command to run Python from the console is either python
or py
as shown below:
C:\Users\nsebhastian>python3 -V
'python3' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\nsebhastian>python -V
Python 3.10.8
C:\Users\nsebhastian>py -V
Python 3.10.8
If you want to use the python3
alias, then you can rename the python.exe
file in your programs folder to python3.exe
:
But keep in mind that this will disable the py
and python
commands from the command prompt:
C:\Users\nsebhastian>python3 -V
Python 3.10.8
C:\Users\nsebhastian>py -V
Can't find a default Python.
C:\Users\nsebhastian>python -V
Python was not found; run without arguments to install
from the Microsoft Store, or disable this shortcut
from Settings > Manage App Execution Aliases.
If you also want to keep the original commands working, then you need to copy the executable file so that you have both python.exe
and python3.exe
in your path:
This way, Windows automatically refer to the right executable file for the alias you used.
And that’s how you get to fix the ‘python3’ is not recognized as an internal or external command error in Windows.
I hope this tutorial helps. Until next time! 👋