When installing the required third-party library, the command line input pip prompts that it is not an internal or external command

Introduction

When doing Python development, when installing the required third-party libraries, most people like to choose to install them with pip on the command line.

However, sometimes typing the pip command prompts that 'pip' is not an internal or external command. . As shown in the picture:

Solution

1. Find the script folder in the python installation directory, and check whether there is a pip3.exe file in the folder.

2. If not, enter on the command line: python -m ensurepip to download the pip.exe file

3. Find the script folder in the python installation directory, check inside the folder, you can see that the file pip3.exe exists.

 4. Verify that pip is installed successfully, and the interface as shown in the figure appears, which means that pip has been successfully installed.

appendix

If there is pip.exe in the script folder, then there is a problem with the environment path of cmd

Enter path c:\windows\system32\ on the command line

 

Or add %SystemRoot%System32 to the environment variable

 

Some python libraries cannot be used in the windows environment. In order not to affect the learning and use, a download method of the whl package is added here.

Python open-source extension packages 

https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

There are many packages in .whl format in this website, which is a very good resource site. 

Demonstrate the installation of whl files with an example

1. First download the required library package on the website

2.win+R to open the terminal

3. Execute pip install D:\curses-2.2+utf8-cp37-cp37m-win_amd64.whl in the terminal (I downloaded and installed curses)

Additionally, if you install

At the same time, it is true that many packages are not easy to install under Windows. You can download the python package locally, enter the folder (under the setup.py path) from the command line, and enter:
 $ python setup.py install

Then you can install third-party libraries into python.

Guess you like

Origin blog.csdn.net/nhb687095/article/details/131611185