安装django(使用国内镜像) 您所在的位置:网站首页 pycharm安装django超时 安装django(使用国内镜像)

安装django(使用国内镜像)

2023-04-14 04:21| 来源: 网络整理| 查看: 265

1.安装django之前需要安装python及pip,   python与django的对应版本请自行百度

2.安装之后,需要配置python及pip的环境变量,具体配置方法请自行百度

3.django的安装:使用pip install django 默认安装最新版本的django

安装时候若有如下报错:

File "c:\install\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.

 

原因:

这是因为pip的默认源在国外,pip install some_packages特别慢,经常会超时,导致安装失败;所以把pip 更换为国内的镜像,就可以很快的下载安装了。

解决:

临时使用国内镜像

打开cmd命令行输入:

pip install some_package --index https://pypi.mirrors.ustc.edu.cn/simple/ #使用清华大学的镜像

比如安装django库:pip install django --index https://pypi.tuna.tsinghua.edu.cn/simple

使用国内镜像即可快速下载。 永久使用国内镜像

windows中,在Users目录下直接创建一个pip.ini文件,把下面内容保存即可。例如我的目录:C:\Users\83979\pip.ini

[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple

 

常用的镜像

阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/豆瓣(douban) http://pypi.douban.com/simple/清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有