Windows下python pip升級失敗的解決方案
阿新 • • 發佈:2019-01-10
Windows下升級pip推薦的方式為:
$ python -m pip install --upgrade pip
這樣操作卻往往會出現下面的錯誤:
Exception:
Traceback (most recent call last):
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "D:\Kangbeibei \python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\req\req_set.py", line 784, in install
**kwargs
File "D:\Kangbeibei \python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip -9.0.3-py3.6.egg\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\wheel.py", line 462, in move_wheel_files
generated.extend(maker.make(spec))
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 372, in make
self._make_script(entry, filenames, options=options)
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 276, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\pip\_vendor\distlib\scripts.py", line 212, in _write_script
launcher = self._get_launcher('t')
File "D:\Kangbeibei\python_project\datamining-learning\decision_tree\venv\lib\site-packages\pip-9.0.3-py3.6.egg\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 -m pip install -U --force-reinstall pip
更多類似的問題可以參考下面的網址解決: