Django使用异常汇总
2018-06-18 03:29:37来源:未知 阅读 ()
使用版本知悉
limengjiedeMacBook-Pro:~ limengjie$ python --version Python 3.6.4 :: Anaconda, Inc. limengjiedeMacBook-Pro:~ limengjie$ python -m django --version 1.11.13
工作需求是1.11.13(安装时,pip版本较低,2.0以下版本安装会超时,2.0以上版本安装正常)
目录
- mac环境下,安装Django 2.0 以下版本报错
mac环境下,安装Django 2.0以下版本报错
使用pycharm安装异常截图
使用命令行安装,异常如下
提示安装超时,并建议更新pip版本号
Last login: Thu Jun 14 16:59:22 on ttys000 limengjiedeMacBook-Pro:~ limengjie$ pip install Django==1.11.13 Collecting Django==1.11.13 Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10ae0ebe0>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/25/4d/c8228419346a0e84aec202a43e181afc6572b861d38f8a0306dbce6abef0/Django-1.11.13-py2.py3-none-any.whl Downloading https://files.pythonhosted.org/packages/25/4d/c8228419346a0e84aec202a43e181afc6572b861d38f8a0306dbce6abef0/Django-1.11.13-py2.py3-none-any.whl (6.9MB) 14% |████▊ | 1.0MB 8.9kB/s eta 0:11:03Exception: Traceback (most recent call last): File "/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 232, in _error_catcher yield File "/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 314, in read data = self._fp.read(amt) File "/anaconda3/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 60, in read data = self.__fp.read(amt) File "/anaconda3/lib/python3.6/http/client.py", line 449, in read n = self.readinto(b) File "/anaconda3/lib/python3.6/http/client.py", line 493, in readinto n = self.fp.readinto(b) File "/anaconda3/lib/python3.6/socket.py", line 586, in readinto return self._sock.recv_into(b) File "/anaconda3/lib/python3.6/ssl.py", line 1009, in recv_into return self.read(nbytes, buffer) File "/anaconda3/lib/python3.6/ssl.py", line 871, in read return self._sslobj.read(len, buffer) File "/anaconda3/lib/python3.6/ssl.py", line 631, in read v = 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 "/anaconda3/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/anaconda3/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run wb.build(autobuilding=True) File "/anaconda3/lib/python3.6/site-packages/pip/wheel.py", line 749, in build self.requirement_set.prepare_files(self.finder) File "/anaconda3/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/anaconda3/lib/python3.6/site-packages/pip/req/req_set.py", line 620, in _prepare_file session=self.session, hashes=hashes) File "/anaconda3/lib/python3.6/site-packages/pip/download.py", line 821, in unpack_url hashes=hashes File "/anaconda3/lib/python3.6/site-packages/pip/download.py", line 659, in unpack_http_url hashes) File "/anaconda3/lib/python3.6/site-packages/pip/download.py", line 882, in _download_http_url _download_url(resp, link, content_file, hashes) File "/anaconda3/lib/python3.6/site-packages/pip/download.py", line 603, in _download_url hashes.check_against_chunks(downloaded_chunks) File "/anaconda3/lib/python3.6/site-packages/pip/utils/hashes.py", line 46, in check_against_chunks for chunk in chunks: File "/anaconda3/lib/python3.6/site-packages/pip/download.py", line 571, in written_chunks for chunk in chunks: File "/anaconda3/lib/python3.6/site-packages/pip/utils/ui.py", line 139, in iter for x in it: File "/anaconda3/lib/python3.6/site-packages/pip/download.py", line 560, in resp_read decode_content=False): File "/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream data = self.read(amt=amt, decode_content=decode_content) File "/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read flush_decoder = True File "/anaconda3/lib/python3.6/contextlib.py", line 99, in __exit__ self.gen.throw(type, value, traceback) File "/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 237, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. You are using pip version 9.0.1, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
解决方案:
You are using pip version 9.0.1, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
按照提示,更新pip版本后,安装正常
limengjiedeMacBook-Pro:~ limengjie$ pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 23kB/s Installing collected packages: pip Found existing installation: pip 9.0.1 Uninstalling pip-9.0.1: Successfully uninstalled pip-9.0.1 Successfully installed pip-10.0.1 limengjiedeMacBook-Pro:~ limengjie$ pip install Django==1.11.13 Collecting Django==1.11.13 Downloading https://files.pythonhosted.org/packages/25/4d/c8228419346a0e84aec202a43e181afc6572b861d38f8a0306dbce6abef0/Django-1.11.13-py2.py3-none-any.whl (6.9MB) 100% |████████████████████████████████| 7.0MB 30kB/s Requirement already satisfied: pytz in /anaconda3/lib/python3.6/site-packages (from Django==1.11.13) (2017.3) Installing collected packages: Django Found existing installation: Django 2.0.6 Uninstalling Django-2.0.6: Successfully uninstalled Django-2.0.6 Successfully installed Django-1.11.13
安装成功验证:
方法一:
>>> import django >>> print django.VERSION # Python2的格式 >>> print(django.VERSION) # python3版本 (1, 11, 13, 'final', 0)
方法二:(也是通过查看版本号,python -m django --version)
limengjiedeMacBook-Pro:~ limengjie$ python -m django --version
1.11.13
(续)
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- Django项目中使用qq第三方登录。 2019-08-13
- Python连载30-多线程之进程&线程&线程使用 2019-08-13
- Python学习日记(十) 生成器和迭代器 2019-08-13
- 【Python】语法基础 | 开始使用Python 2019-08-13
- 使用scrapy框架爬取全书网书籍信息。 2019-08-13
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash