python 3.9:将 pip 从 22.0 升级到 22.0.2 时出错

python 3.9: Error upgrading pip from 22.0 to 22.0.2

尝试升级 pip 时收到以下错误。

C:\Windows\system32>py -m pip list --outdated
Package Version Latest Type
------- ------- ------ -----
pip     22.0    22.0.2 wheel

正在升级:

C:\Windows\system32>py -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\pedro\appdata\roaming\python\python39\site-packages (22.0)
Collecting pip
  Using cached pip-22.0.2-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.0
    Uninstalling pip-22.0:
      Successfully uninstalled pip-22.0
  WARNING: No metadata found in c:\users\pedro\appdata\roaming\python\python39\site-packages
  Rolling back uninstall of pip
  Moving to c:\users\pedro\appdata\roaming\python\python39\scripts\
   from C:\Users\pedro\AppData\Roaming\Python\Python39\~cripts
  Moving to c:\users\pedro\appdata\roaming\python\python39\site-packages\pip-22.0.dist-info\
   from C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\~ip-22.0.dist-info
  Moving to c:\users\pedro\appdata\roaming\python\python39\site-packages\pip\
   from C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\~ip
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\commands\install.py", line 405, in run
    installed = install_given_reqs(
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\req\__init__.py", line 73, in install_given_reqs
    requirement.install(
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\req\req_install.py", line 769, in install
    install_wheel(
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\operations\install\wheel.py", line 729, in install_wheel
    _install_wheel(
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\operations\install\wheel.py", line 646, in _install_wheel
    generated_console_scripts = maker.make_multiple(scripts_to_generate)
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\distlib\scripts.py", line 428, in make_multiple
    filenames.extend(self.make(specification, options))
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_internal\operations\install\wheel.py", line 427, in make
    return super().make(specification, options)
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\distlib\scripts.py", line 417, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\distlib\scripts.py", line 317, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\distlib\scripts.py", line 247, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\pedro\AppData\Roaming\Python\Python39\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

这个link救了我一命!

我已经按照那里的解释解决了。基本上:

  1. 卸载安装工具
  2. 升级点数
  3. 重新安装设置工具