"'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.
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.
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.
Then click "Advanced System Settings" on the "System" page that pops up.
Enter the "System Properties" interface - "Advanced" - "Environment Variables" to configure system properties and add environment variables.
Method 2:
Use win+R to open the "Run" interface, enter sysdm.cpl
to directly open the "System Properties" interface - "Advanced" - "Environment Variables"
Set and add environment variables
After entering the environment variables page, "System Variables" - "Path" - "Edit".
After entering the "Edit Environment Variables" page, click "New" and paste the copied Script path.
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.