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

错误重现

C:Userszhang>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:userszhangappdata oamingpythonpython37scriptspip.exe
from C:UserszhangAppDataLocalTemppip-uninstall-tjofohy6pip.exe
Moving to c:userszhangappdata oamingpythonpython37scriptspip3.7.exe
from C:UserszhangAppDataLocalTemppip-uninstall-tjofohy6pip3.7.exe
Moving to c:userszhangappdata oamingpythonpython37scriptspip3.exe
from C:UserszhangAppDataLocalTemppip-uninstall-tjofohy6pip3.exe
Moving to c:userszhangappdata oamingpythonpython37site-packagespip-19.0.3.dist-info
from c:userszhangappdata oamingpythonpython37site-packages~ip-19.0.3.dist-info
Moving to c:userszhangappdata oamingpythonpython37site-packagespip
from c:userszhangappdata oamingpythonpython37site-packages~ip
Exception:
Traceback (most recent call last):
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_internalcliase_command.py", line 179, in main
status = self.run(options, args)
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_internalcommandsinstall.py", line 393, in run
use_user_site=options.use_user_site,
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_internal eq_init_.py", line 57, in install_given_reqs
**kwargs
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_internal eq eq_install.py", line 913, in install
use_user_site=use_user_site, pycompile=pycompile,
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_internal eq eq_install.py", line 445, in move_wheel_files
warn_script_location=warn_script_location,
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_internalwheel.py", line 544, in move_wheel_files
generated.extend(maker.make(spec))
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_vendordistlibscripts.py", line 405, in make
self._make_script(entry, filenames, options=options)
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_vendordistlibscripts.py", line 309, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_vendordistlibscripts.py", line 245, in _write_script
launcher = self._get_launcher('t')
File "C:UserszhangAppDataRoamingPythonPython37site-packagespip_vendordistlibscripts.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
原文地址:https://www.cnblogs.com/zhangxuel1ang/p/14257638.html