Python Notes - Solution to "'pip' is not recognized as an internal or external command, operable program or batch file"

"'pip' is not recognized as an internal or external command, operable program or batch file" solution

For Python learners, it is often necessary to install some third-party libraries. We often choose to use the command on the cmd terminal command line pip install + 要安装的库to install.
However, sometimes when using the pip command in the terminal, it will prompt "'pip' is not an internal or external command, nor is it an operable program or batch file." This is because if the Path of pip is not configured, our system cannot find the pip command, and the above error message will appear. Alt
Therefore, in order to solve this problem, we need to configure the path of pip so that our computer can recognize this command.

Copy Script path new changes

First of all, whether you install Python or Anaconda, there will be a Scripts folder. Find the absolute path to this Script directory. For example, the absolute path of Scripts on my computer is E:\Python\venv\Scripts, copy it.
Alt

Modify environment variables

Then modify the environment variables. There are two convenient methods to modify environment variables:
Method 1:
Right-click the mouse on "My Computer" and select "Properties" in the pop-up menu.
Alt
Then click "Advanced System Settings" on the "System" page that pops up.
Alt
Enter the "System Properties" interface - "Advanced" - "Environment Variables" to configure system properties and add environment variables.
Alt

Method 2:
Use win+R to open the "Run" interface, enter sysdm.cpl
Alt
to directly open the "System Properties" interface - "Advanced" - "Environment Variables"
Alt

Set and add environment variables

After entering the environment variables page, "System Variables" - "Path" - "Edit".
Insert image description here
After entering the "Edit Environment Variables" page, click "New" and paste the copied Script path.
Insert image description here

Environment variable modification completed

Finally, restart the command window. Enter pip in the cmd command prompt window. If no errors are prompted, the configuration is successful. You can use the pip command directly in the future.
Insert image description here

Guess you like

Origin blog.csdn.net/m0_51662391/article/details/124148388