win10命令行pip报错解决的方法

win10 2004更新后出现命令行下pip无法使用报错的问题,报错内容如下:

© 2020 Microsoft Corporation. 保留所有权利。

C:\Users\Administrator\Desktop>pip
Traceback (most recent call last):
File “f:\python36\lib\runpy.py”, line 193, in _run_module_as_main
main”, mod_spec) File “f:\python36\lib\runpy.py”, line 85, in run_code
exec(code, run_globals) File "F:\Python36\Scripts\pip.exe_main
.py", line 5, in
ModuleNotFoundError: No module named ‘pip’

  • 解决的方法,执行以下两条命令重装PIP:
    1. python -m ensurepip

python -m ensurepip
Looking in links:
C:\Users\ADMINI~1\AppData\Local\Temp\tmpjz1wdc42 Requirement already
satisfied: setuptools in f:\python36\lib\site-packages (40.6.2)
Collecting pip Installing collected packages: pip Successfully
installed pip-18.1

    1. python -m pip install --upgrade pip

python -m pip install --upgrade pip Collecting pip Using cached
https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: pip Found existing installation: pip
18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1 Successfully installed pip-20.1.1

  • 自此,pip可以正常使用了

pip -V
pip 20.1.1 from f:\python36\lib\site-packages\pip (python 3.6)

你可能感兴趣的:(PYTHON爬虫,博客写作)