89308
pip自体をアップグレードするために

```

    pip install -U pip
    
```

と実行したら以下のエラーがでました。

```

    Requirement already satisfied: pip in c:\users\XXX\appdata\roaming\python\python37\site-packages (21.3.1)
    Collecting pip
      Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
    Installing collected packages: pip
      Attempting uninstall: pip
        Found existing installation: pip 21.3.1
        Uninstalling pip-21.3.1:
          Successfully uninstalled pip-21.3.1
      Rolling back uninstall of pip
      Moving to c:\users\XXX\appdata\roaming\python\python37\scripts\pip.exe
       from C:\Users\XXX\AppData\Local\Temp\pip-uninstall-9p0nuyo8\pip.exe
      Moving to c:\users\XXX\appdata\roaming\python\python37\scripts\pip3.7.exe
       from C:\Users\XXX\AppData\Local\Temp\pip-uninstall-9p0nuyo8\pip3.7.exe
      Moving to c:\users\XXX\appdata\roaming\python\python37\scripts\pip3.exe
       from C:\Users\XXX\AppData\Local\Temp\pip-uninstall-9p0nuyo8\pip3.exe
      Moving to c:\users\XXX\appdata\roaming\python\python37\site-packages\pip-21.3.1.dist-info\
       from c:\users\XXX\appdata\roaming\python\python37\site-packages\~ip-21.3.1.dist-info
      Moving to c:\users\XXX\appdata\roaming\python\python37\site-packages\pip\
       from c:\users\XXX\appdata\roaming\python\python37\site-packages\~ip
    ERROR: Exception:
    Traceback (most recent call last):
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\base_command.py", line 164, in exc_logging_wrapper
        status = run_func(*args)
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
        return func(self, options, args)
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\commands\install.py", line 413, in run
        pycompile=options.compile,
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\__init__.py", line 81, in install_given_reqs
        pycompile=pycompile,
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 810, in install
        requested=self.user_supplied,
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 737, in install_wheel
        requested=requested,
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\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\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 428, in make_multiple
        filenames.extend(self.make(specification, options))
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_internal\operations\install\wheel.py", line 427, in make
        return super().make(specification, options)
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 417, in make
        self._make_script(entry, filenames, options=options)
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 317, in _make_script
        self._write_script(scriptnames, shebang, script, filenames, ext)
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 247, in _write_script
        launcher = self._get_launcher('t')
      File "C:\Users\XXX\AppData\Roaming\Python\Python37\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: You are using pip version 21.3.1; however, version 22.1.2 is available.
    You should consider upgrading via the 'c:\users\XXX\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.
    
```

PowerShellは

```

    c:\users\XXX\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip
    
```

にしろと言っていると思いコピペで再実行したのですが、全く同じエラーが発生してアップグレードができませんでした。

どのように解決したらよろしいでしょうか。
CC BY-SA 4.0
2022-06-09T12:55:03.663
89304
2022-06-10T00:05:17.033
48769
question
python pip
pipのアップグレードができない
こんなほぼ同様な現象の記事を見つけました。  
[pip｜アップデートでエラーが出た話](https://note.com/mnyacat_noob/n/n74af63d1ade9)

更に元となる記事はこちら。  
[Document Windows 10 update solution
#8450](https://github.com/pypa/pip/issues/8450)

細かい版数は違いますが、発生している現象のログがだいたい同じと思われます。

両方の記事で解決方法は以下を実行すること、となっています。

>
```

>     python -m pip uninstall pip
>     python -m ensurepip
>     python -m pip install -U pip
>  
```

試してみてください。
CC BY-SA 4.0
2022-06-10T00:05:17.033
89308
2022-06-10T00:05:17.033
26370
89304
answer