更新pip报错AttributeError: 'NoneType' object has no attribute 'bytes'

错误信息:

C:\Users\zhang>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.0.3
Uninstalling pip-19.0.3:
Successfully uninstalled pip-19.0.3
Rolling back uninstall of pip
Moving to c:\users\zhang\appdata\roaming\python\python37\scripts\pip.exe
from C:\Users\zhang\AppData\Local\Temp\pip-uninstall-tjofohy6\pip.exe
Moving to c:\users\zhang\appdata\roaming\python\python37\scripts\pip3.7.exe
from C:\Users\zhang\AppData\Local\Temp\pip-uninstall-tjofohy6\pip3.7.exe
Moving to c:\users\zhang\appdata\roaming\python\python37\scripts\pip3.exe
from C:\Users\zhang\AppData\Local\Temp\pip-uninstall-tjofohy6\pip3.exe
Moving to c:\users\zhang\appdata\roaming\python\python37\site-packages\pip-19.0.3.dist-info
from c:\users\zhang\appdata\roaming\python\python37\site-packages~ip-19.0.3.dist-info
Moving to c:\users\zhang\appdata\roaming\python\python37\site-packages\pip
from c:\users\zhang\appdata\roaming\python\python37\site-packages~ip
Exception:
Traceback (most recent call last):
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_internal\cli\base_command.py", line 179, in main
status = self.run(options, args)
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_internal\commands\install.py", line 393, in run
use_user_site=options.use_user_site,
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_internal\req_init_.py", line 57, in install_given_reqs
**kwargs
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_internal\req\req_install.py", line 913, in install
use_user_site=use_user_site, pycompile=pycompile,
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_internal\req\req_install.py", line 445, in move_wheel_files
warn_script_location=warn_script_location,
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_internal\wheel.py", line 544, in move_wheel_files
generated.extend(maker.make(spec))
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 405, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 309, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 245, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\zhang\AppData\Roaming\Python\Python37\site-packages\pip_vendor\distlib\scripts.py", line 384, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
最后的两行让你重新更新,但是重新并没有卵用=-=

解决方法:

方法1:
for Windows :【已测试】
python -m pip install -U pip
for Linux :【未测试】
pip install -U pip
方法二:
【方法一不能成功使用方法二】
easy_install -U pip

附:

查看pip 版本:
pip --version

你可能感兴趣的:(更新pip报错AttributeError: 'NoneType' object has no attribute 'bytes')