When using cmd to enter Python in win11, an error occurred: 'python' is not recognized as an internal or external command, operable program or batch file or 'python' is not recognized as an internal or external command, operable program or batch file . It can be solved using the following methods.
0. Reinstall Python from the Microsoft store.
(Of course, everyone basically downloads and installs it from the Python official website. If you don’t want to reinstall Python or don’t want to have multiple versions of Python on your computer, please read on)
1. Turn off application execution aliases
Click on Settings-Application-Advanced Application Settings-Application Execution Aliases
Or directly search for "Application Execution Aliases" in the Start menu
Close after finding Python
2. Add working path
Open Settings-System-System Information-Advanced System Settings or directly search for "Advanced System Settings"
In the window that pops up, click Advanced - Environment Variables, find path in "System Variables", click Edit, copy and add the Python installation path and save it. For example, my path is D:\Program Files\Python\311
3. Check
Enter python in cmd to check whether the setting is successful. If the version is displayed correctly, it is successful.