Python 3.7 - Windows 10 上的 PIP 升级错误

Mac*_*iek 1 python windows installation pip python-3.x

我尝试使用以下命令在控制台中更新 PIP(Windows 10,Python 3.7.1):

python37 -m pip install --upgrade pip
Run Code Online (Sandbox Code Playgroud)

这是我每次尝试更新时遇到的错误:

>Exception:
Traceback (most recent call last):
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\wheel.py", line 462, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 212, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\5gyblo\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 351, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
Run Code Online (Sandbox Code Playgroud)

令人惊讶的事实 - 我成功地更新了 Python 2.7 上的 PIP,没有任何问题。

小智 8

我在尝试从 pip 版本 18.1 升级到 19.0.3 时遇到了这个错误。经过大量搜索后,我在https://packaging.python.org/tutorials/installing-packages/ 找到了解决方案 (如果仍然不允许您运行 pip:

安全下载 get-pip.py [1]

运行 python get-pip.py。[2] 这将安装或升级 pip。此外,如果尚未安装 setuptools 和 wheel,它将安装它们。)

那里的链接将带您到:

使用https://bootstrap.pypa.io/get-pip.py

下载并保存文件,从命令提示符运行它。它对我来说就像一种魅力。