关于pip升级损坏导致的问题记录

  • Post author:
  • Post category:其他


升级pip后,出现异常,导致无法进行任何的pip相关的操作。网上找了很多教程,都无效,后来经过反复摸索,问题解决了。

尝试方案1:


Python中更新pip失败导致损坏的修复_老鱼干的博客-CSDN博客_python3修复pip



运行提示没有pip模块


PS C:\Users\86176> pip install –upgrade pip

Traceback (most recent call last):

File “d:\program files\python38\lib\runpy.py”, line 194, in _run_module_as_main

return _run_code(code, main_globals, None,

File “d:\program files\python38\lib\runpy.py”, line 87, in _run_code

exec(code, run_globals)

File “D:\Program Files\Python38\Scripts\pip.exe\__main__.py”, line 4, in <module>

ModuleNotFoundError: No module named ‘pip’

解决办法

执行

python -m ensurepip,python -m pip install –upgrade pip

即可

PS C:\Users\86176>

python -m ensurepip


Looking in links: c:\Users\86176\AppData\Local\Temp\tmpjplwmax8

Requirement already satisfied: setuptools in d:\program files\python38\lib\site-packages (49.2.1)

Processing c:\users\86176\appdata\local\temp\tmpjplwmax8\pip-20.2.1-py2.py3-none-any.whl

Installing collected packages: pip

Successfully installed pip-20.2.1

PS C:\Users\86176>

PS C:\Users\86176>

python -m pip install –upgrade pip


Looking in indexes: https://pypi.douban.com/simple

Collecting pip

Using cached https://pypi.doubanio.com/packages/7c/02/9ab8b431aca1b46fcc1ac830a5870a28a12ba1abfa681904b1d2da876a86/pip-21.2.1-py3-none-any.whl (1.6 MB)

Installing collected packages: pip

Attempting uninstall: pip

Found existing installation: pip 20.2.1

Uninstalling pip-20.2.1:

Successfully uninstalled pip-20.2.1

Successfully installed pip-21.2.1

测试

PS C:\Users\86176>

pip list



方案1验证无效

方案2

找到之前安装OK的版本,进入 D:\Python\Lib\site-packages\ 路径,找到

pip



pip-22.1.2.dist-info

目录,将其复制到对应的路径下,问题解决。



版权声明:本文为zh6526157原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。