欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Pycharm安装django失败

程序员文章站 2022-03-03 21:57:19
报错截图### 详细报错如下:(venv) wh@WHdeMacBook-Pro:~/PycharmProjects/django_test01/venv/bin$./pip install djangoCollecting django Downloading https://files.pythonhosted.org/packages/ca/ab/5e004afa025a6fb640c6e983d4983e6507421ff01be224da79ab7de7a21f/Django-3.0.8-...

报错截图Pycharm安装django失败

祥细报错如下:

(venv) wh@WHdeMacBook-Pro:~/PycharmProjects/django_test01/venv/bin$./pip install django
Collecting django
  Downloading https://files.pythonhosted.org/packages/ca/ab/5e004afa025a6fb640c6e983d4983e6507421ff01be224da79ab7de7a21f/Django-3.0.8-py3-none-any.whl (7.5MB)
     |████████                        | 1.9MB 9.6kB/s eta 0:09:41ERROR: Exception:
Traceback (most recent call last):
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 397, in _error_catcher
    yield
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 479, in read
    data = self._fp.read(amt)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/Users/wh/.pyenv/versions/3.7.5/lib/python3.7/http/client.py", line 457, in read
    n = self.readinto(b)
  File "/Users/wh/.pyenv/versions/3.7.5/lib/python3.7/http/client.py", line 501, in readinto
    n = self.fp.readinto(b)
  File "/Users/wh/.pyenv/versions/3.7.5/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/Users/wh/.pyenv/versions/3.7.5/lib/python3.7/ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "/Users/wh/.pyenv/versions/3.7.5/lib/python3.7/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 "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 307, in _get_abstract_dist_for
    self.require_hashes
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 199, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 1064, in unpack_url
    progress_bar=progress_bar
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 924, in unpack_http_url
    progress_bar)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 1152, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 861, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/utils/hashes.py", line 75, in check_against_chunks
    for chunk in chunks:
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 829, in written_chunks
    for chunk in chunks:
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/utils/ui.py", line 156, in iter
    for x in it:
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 818, in resp_read
    decode_content=False):
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 531, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 496, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/Users/wh/.pyenv/versions/3.7.5/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/wh/PycharmProjects/django_test01/venv/lib/python3.7/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.

解决办法

1. pip更新超时
./pip install --upgrade pip   #我在升级这一步没有报错
2.换源下载django
pip install -i https://pypi.douban.com/simple django

本文地址:https://blog.csdn.net/m0_37490554/article/details/107637602

相关标签: python