ModuleNotFoundError: No module named ‘pip‘ ------ 没有名为“pip”的模块解决问题

问题描述:
今天升级pip时,升级失败,导致pip用不了,报错没有名为“pip”的模块,

C:\Users\asus>pip list
Traceback (most recent call last):
  File "d:\users\asus\appdata\local\programs\python\python38\lib\runpy.py", line
 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\users\asus\appdata\local\programs\python\python38\lib\runpy.py", line
 86, in _run_code
    exec(code, run_globals)
  File "D:\Users\asus\AppData\Local\Programs\Python\Python38\Scripts\pip.exe\__m
ain__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

解决方法如下:
在cmd中输入以下两句命令:

python -m ensurepip

python -m pip install --upgrade pip
C:\>python -m ensurepip
Looking in links: C:\Users\ADMINI~1.TY-\AppData\Local\Temp\tmp2nl_kpkn
Requirement already satisfied: setuptools in e:\python-3.7.3\lib\site-packages (40.8.0)
Collecting pip
Installing collected packages: pip
Successfully installed pip-19.0.3
C:\>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/bd/b1/56a834acdbe23b486dea16aaf4c27ed28eb292695b90d01dff96c96597de/pip-20.2.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-20.2.1

再次查询时,报错已经解决

C:\>pip --version
pip 20.2.1 from e:\python-3.7.3\lib\site-packages\pip (python 3.7)

你可能感兴趣的:(接口自动化测试笔记)