• 安装django(使用国内镜像)


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

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

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

    安装时候若有如下报错:

    File "c:installpython37libsite-packagespip\_vendorurllib3 esponse.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:Users83979pip.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/

  • 相关阅读:
    nginx 安装配置
    mysql分表
    冲刺day7
    冲刺day6
    冲刺day5
    冲刺day4
    冲刺day3
    冲刺day2
    冲刺day1
    撰写《需求规格说明书》的工作流程、组员分工和组员工作量比例
  • 原文地址:https://www.cnblogs.com/whyan/p/11565403.html
Copyright © 2020-2023  润新知