pip install django==2.2 报错处理

一、报错如下:

C:\Users\20798>pip install django==2.2
Collecting django==2.2
  Downloading https://files.pythonhosted.org/packages/54/85/0bef63668fb170888c1a2970ec897d4528d6072f32dee27653381a332642/Django-2.2-py3-none-any.whl (7.4MB)
     |                                | 40kB 1.3kB/s eta 1:33:12ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher
    yield
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in read
    data = self._fp.read(amt)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\http\client.py", line 457, in read
    n = self.readinto(b)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\http\client.py", line 501, in readinto
    n = self.fp.readinto(b)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\ssl.py", line 929, 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\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\legacy_resolve.py", line 307, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\operations\prepare.py", line 199, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 1064, in unpack_url
    progress_bar=progress_bar
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 924, in unpack_http_url
    progress_bar)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 861, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunks
    for chunk in chunks:
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 829, in written_chunks
    for chunk in chunks:
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iter
    for x in it:
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\download.py", line 818, in resp_read
    decode_content=False):
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\20798\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, 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.

二、解决办法:

C:\Users\20798>pip install django==2.2 --user -i https://pypi.douban.com/simple
Looking in indexes: https://pypi.douban.com/simple
Collecting django==2.2
  Downloading https://pypi.doubanio.com/packages/54/85/0bef63668fb170888c1a2970ec897d4528d6072f32dee27653381a332642/Django-2.2-py3-none-any.whl (7.4MB)
     |████████████████████████████████| 7.5MB 3.2MB/s
Collecting sqlparse (from django==2.2)
  Downloading https://pypi.doubanio.com/packages/85/ee/6e821932f413a5c4b76be9c5936e313e4fc626b33f16e027866e1d60f588/sqlparse-0.3.1-py2.py3-none-any.whl (40kB)
     |████████████████████████████████| 40kB 1.3MB/s
Collecting pytz (from django==2.2)
  Downloading https://pypi.doubanio.com/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
     |████████████████████████████████| 512kB 2.2MB/s
Installing collected packages: sqlparse, pytz, django
  WARNING: The script sqlformat.exe is installed in 'C:\Users\20798\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script django-admin.exe is installed in 'C:\Users\20798\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed django-2.2 pytz-2019.3 sqlparse-0.3.1
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
发布了10 篇原创文章 · 获赞 3 · 访问量 1877

猜你喜欢

转载自blog.csdn.net/tttt0611/article/details/105223426