pip升级:“ python -m pip install --upgrade”说已经是最新的(18.0),“ pip --version”说(10.0.1)

时间:2018-07-29 09:27:52

标签: python cmd pip pycharm pypy

我试图通过Windows 7上的“ cmd”中的pip通过PyPI安装一些软件包,如下所示:

C:\Users\acer\PycharmProjects\Test\venv\Scripts>pip install (some package)

但是安装失败并显示以下消息(直接从cmd收到):

Exception:
Traceback (most recent call last):
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_vendor\urllib3\response.py", line 302, in _error_catcher
    yield
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_vendor\urllib3\response.py", line 384, in read
    data = self._fp.read(amt)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "C:\Users\acer\AppData\Local\Programs\Python\Python37-32\lib\http\client.
py", line 447, in read
    n = self.readinto(b)
  File "C:\Users\acer\AppData\Local\Programs\Python\Python37-32\lib\http\client.
py", line 491, in readinto
    n = self.fp.readinto(b)
  File "C:\Users\acer\AppData\Local\Programs\Python\Python37-32\lib\socket.py",
line 589, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\acer\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", lin
e 1049, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\acer\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", lin
e 908, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\commands\install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\operations\prepare.py", line 310, in prepare_linked_require
ment
    progress_bar=self.progress_bar
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\download.py", line 837, in unpack_url
    progress_bar=progress_bar
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\download.py", line 674, in unpack_http_url
    progress_bar)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\download.py", line 898, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\download.py", line 618, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\utils\hashes.py", line 48, in check_against_chunks
    for chunk in chunks:
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\download.py", line 586, in written_chunks
    for chunk in chunks:
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\utils\ui.py", line 159, in iter
    for x in it:
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_internal\download.py", line 575, in resp_read
    decode_content=False):
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_vendor\urllib3\response.py", line 436, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_vendor\urllib3\response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "C:\Users\acer\AppData\Local\Programs\Python\Python37-32\lib\contextlib.p
y", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3
.7.egg\pip\_vendor\urllib3\response.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 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

我尝试将pip升级到版本18.0,因此我在cmd(Windows 7)上运行python -m pip install --upgrade

C:\Users\acer\PycharmProjects\Test\venv\Scripts>python -m pip install --upgrade pip

运行它之后,我输入pip --version来检查我现在的版本:

C:\Users\acer\PycharmProjects\Test\venv\Scripts>pip --version

但是响应是我有pip版本10.0.1:

pip 10.0.1 from c:\users\acer\pycharmprojects\test\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)

再次运行升级命令后,响应pip已经是最新的:

Requirement already up-to-date: pip in c:\users\acer\pycharmprojects\test\venv\lib\site-packages (18.0)

两个答案为什么有区别?以及如何正确升级点子?

0 个答案:

没有答案