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

时间:2018-12-13 14:26:39

标签: python python-3.x windows pip install

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

python37 -m pip install --upgrade pip

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

>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'

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

2 个答案:

答案 0 :(得分:0)

您可以尝试:

python -m pip install -U --force-reinstall pip

答案 1 :(得分:0)

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

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

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

那里的链接将您带到:

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

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