使用如下命令更新pip时报错
python -m pip install -U pip 或者 python -m pip install -upgrade pip
详细报错信息如下↓
Exception:
Traceback (most recent call last):
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_internal\cli\base_command.py", line 179, in main
status = self.run(options, args)
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_internal\commands\install.py", line 393, in run
use_user_site=options.use_user_site,
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_internal\req\__init__.py", line 57, in install_given_reqs
**kwargs
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_internal\req\req_install.py", line 913, in install
use_user_site=use_user_site, pycompile=pycompile,
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_internal\req\req_install.py", line 445, in move_wheel_files
warn_script_location=warn_script_location,
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_internal\wheel.py", line 544, in move_wheel_files
generated.extend(maker.make(spec))
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_vendor\distlib\scripts.py", line 405, in make
self._make_script(entry, filenames, options=options)
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_vendor\distlib\scripts.py", line 309, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_vendor\distlib\scripts.py", line 245, in _write_script
launcher = self._get_launcher('t')
File "d:\PychramProject\aaa\venv\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_vendor\distlib\scripts.py", line 384, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
解决办法↓
easy_install -U pip
命令行显示如下信息说明升级成功
Searching for pip
Reading https://pypi.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl#sha256=37fd50e056e2aed635dec96594606f0286
640489b0db0ce7607f7e51890372d5
Best match: pip 21.0.1
Processing pip-21.0.1-py3-none-any.whl
Installing pip-21.0.1-py3-none-any.whl to d:\pychramproject\aaa\venv\lib\site-packages
Adding pip 21.0.1 to easy-install.pth file
Installing pip-script.py script to d:\PychramProject\aaa\venv\Scripts
Installing pip.exe script to d:\PychramProject\aaa\venv\Scripts
Installing pip3-script.py script to d:\PychramProject\aaa\venv\Scripts
Installing pip3.exe script to d:\PychramProject\aaa\venv\Scripts
Installing pip3.9-script.py script to d:\PychramProject\aaa\venv\Scripts
Installing pip3.9.exe script to d:\PychramProject\aaa\venv\Scripts
Installed d:\pychramproject\aaa\venv\lib\site-packages\pip-21.0.1-py3.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
查看结果
(venv) D:\PychramProject\aaa>pip list
Package Version
---------- -------
pip 21.0.1
setuptools 40.8.0