天天看點

Python3 pip 更新報錯問題解決方法分享

作者:墨客moke
Python在安裝第三方庫時有這樣的報錯提醒:
ERROR: To modify pip, please run the following command:

C:\Program Files\python3-10\python.exe -m pip install --user --upgrade pip

WARNING: Ignoring invalid distribution -irsearch (c:\program files\python3-10\lib\site-packages)

[notice] A new release of pip available: 22.1.2 -> 22.3.1

[notice] To update, run: python.exe -m pip install --upgrade pip           
但是當你按照提醒執行指令時會繼續報錯,詳細如下:
C:\Users\moke>python -m pip install --upgrade pip
WARNING: Ignoring invalid distribution -irsearch (c:\program files\python3-10\lib\site-packages)
WARNING: Ignoring invalid distribution -irsearch (c:\program files\python3-10\lib\site-packages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pip in c:\users\moke\appdata\roaming\python\python310\site-packages (22.1.2)
Collecting pip
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/09/bd/2410905c76ee14c62baf69e3f4aa780226c1bbfc9485731ad018e35b0cb5/pip-22.3.1-py3-none-any.whl (2.1 MB)
WARNING: Ignoring invalid distribution -irsearch (c:\program files\python3-10\lib\site-packages)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.1.2
    Uninstalling pip-22.1.2:
      Successfully uninstalled pip-22.1.2
 
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\moke\AppData\Roaming\Python\Python310\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
**************************************************
  File "C:\Users\moke\AppData\Roaming\Python\Python310\site-packages\pip\_vendor\distlib\scripts.py", line 396, in _get_launcher
    raise ValueError(msg)
ValueError: Unable to find resource t64.exe in package pip._vendor.distlib
WARNING: Ignoring invalid distribution -irsearch (c:\program files\python3-10\lib\site-packages)           
Python3 pip 更新報錯問題解決方法分享

解決方法1:更新setuptools

更新:pip install --upgrade setuptools

版本:python -m pip show setuptools

再更新:python -m pip install --upgrade pip

Python3 pip 更新報錯問題解決方法分享

解決方法2:解除安裝&重裝setuptools

解除安裝:python -m pip uninstall pip setuptools

安裝:pip install --upgrade setuptools

再更新:python -m pip install --upgrade pip

更新檢視PIP 版本

C:\Users\moke>pip show pip
WARNING: Ignoring invalid distribution -irsearch (c:\program files\python3-10\lib\site-packages)
Name: pip
Version: 22.3.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: [email protected]
License: MIT
Location: c:\program files\python3-10\lib\site-packages
Requires:
Required-by:           
Python3 pip 更新報錯問題解決方法分享

問題解決

歡迎需要的朋友點贊關注