【发布时间】: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