【问题标题】:Python 3.7 - PIP upgrade error on windows 10Python 3.7 - Windows 10 上的 PIP 升级错误
【发布时间】:2018-12-13 14:26:38
【问题描述】:

我尝试在控制台中使用命令更新 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,没有任何问题。

【问题讨论】:

  • 您是否尝试过直接从 pip 升级 pip install --upgrade pip?会发生什么?
  • @Idlehands 在 Windows 中使用 pip 升级 pip 是不可能的,因为该死的 Windows 会锁定当前正在运行的进程 pip.exe 并且不允许覆盖它。
  • @phd 奇怪,我实际上使用确切的命令直接升级了pip 几次,没有问题。会不会是Windows版本?似乎在 Windows 7 上运行良好。
  • 我已经尝试过pip install --upgrade pip(结果与您在上面看到的几乎相同)。我已经检查过了,它看起来是 Windows 10 和 Python 3.* 之间的问题。我能够为 python 3.* 安装旧版本的 pip (10.*)。不过,我对 Python 2.* 没有任何问题。这是迄今为止尚未解决的兼容性问题(据我所知)。

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


【解决方案1】:

我在尝试从 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

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

【讨论】:

  • 安全下载对我有用。非常感谢。
  • 谢谢!我尝试了许多其他解决方案,这个最终解决了这个问题!
【解决方案2】:

你可以试试:

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

【讨论】:

  • 不幸的是,我得到了相同的结果:(。
  • 谢谢!解决了我的 pip 进入安装所有以前版本的不断向下循环的问题。烦死人了!
猜你喜欢
  • 2019-07-01
  • 2019-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-25
相关资源
最近更新 更多