Error when installing python library using pip

Error message:
Suggestion [3, General]: The command pip cannot be found, but it does exist at the current location. By default, Windows PowerShell does not load commands from the current location. If you trust this command, type ".\pip" instead. See "get-help about_Command_Precedence" for details.
Insert image description here
Solution 1:
Change the original command: pip install lxml
to: .\pip install lxml

Solution 2: Configure environment variables
If the above error occurs, it can be solved by configuring environment variables for python.
Windows 10 system, Python environment configuration method:
Step 1: Find "My Computer" (or "This Computer"/"Computer"), right-click → Properties → click Advanced System Settings, and the [System Properties] window will pop up.
Insert image description here
Step 2: Click [Environment Variables] to enter the [Environment Variables] configuration window.
Insert image description here
Step 3: Find [System Variables], select the [Path] variable, click [Edit], enter the [Edit Environment Variables] window, add the path to the file where python is installed, and click [OK].
Insert image description here
Note: The file path here refers to your own python installation path. The above path is the installation path of python on my computer.
After configuring the python environment variables, you can directly use the pip installation command
pip install lxml ( .\pip install lxml )
Insert image description here
Note: After configuring the environment variables, an error is still reported when using it. If you use pip in cmd, you need to restart Open cmd; if you use pip in pycharm, you can restart pycharm.

—end—

Guess you like

Origin blog.csdn.net/LHJCSDNYL/article/details/122383829