[SOLVED] 'python' is not recognized as an internal or external command, operable program or batch file

insert image description here

background

Sometimes, when you enter python in cmd, you will be reminded

'python' is not recognized as an internal or external command, operable program or batch file.

After I installed python on the E disk, I entered python, and the following problems were displayed

E:\>python
'python' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

The essence of this problem is actually that the cmd of windows cannot recognize the python symbol (that is, it cannot recognize that this symbol is an executable program), because windows is similar here. When encountering a character, it will first query the symbol in the default path. is not an executable program

The newly installed python is installed under python on the E disk, and this is not a default path of windows, so windows cannot find the symbol python in its default path, so this error will be reported

Solution

Add the installation path of python to the environment variable of windows

1. win7

Right-click My Computer->Properties->Advanced System Configuration->Click the Advanced column, click on the environment variable here->add the python installation path to the system variable PATH, for example, mine is E:\Python3

insert image description here
insert image description here

Enter in cmd python -vto check whether the setting is successful

2.win10

Right-click the four square symbols of win, select System->Advanced System Settings, select the Advanced column in it, click on Environment Variables in this column->add the python installation path to the system variable PATH, for example, mine is E :\Python3

Enter in cmd python -vto check whether the setting is successful

insert image description here

recommended reading

1. 200 sets of Java quality projects
2. Python 200 sets of quality projects

Guess you like

Origin blog.csdn.net/JasonXu94/article/details/130272849