Python环境更新pip模块失败

C:Userspc>pip show pip

Name: pip
Version: 10.0.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: python-virtualenv@groups.google.com
License: MIT
Location: c:userspcappdatalocalprogramspythonpython37libsite-packages
Requires:
Required-by:
You are using pip version 10.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:Userspc>python -m pip install --upgrade pip

Collecting pip
Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
File "C:UserspcAppDataLocalProgramsPythonPython37libsite-packagespip\_vendorurllib3 esponse.py", line 307, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
You are using pip version 10.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

以上是更新pip的报错场景,解决方案:更新指令替换为python -m pip install -U --force-reinstall pip

这个命令好像也可以:python -m pip install -U pip setuptools

具体两个命令有什么区别,还未测试过

原文地址:https://www.cnblogs.com/kimsbo/p/10713160.html