You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装Django时出现ReadTimeoutError超时错误,请求技术解决方案

安装Django超时错误的解决方案

以下是针对HTTPSConnectionPool(host='files.pythonhosted.org', port=443): 读取超时错误的有效解决方法:

  • 临时使用国内PyPI镜像源安装
    执行安装命令时指定国内镜像源,提升下载速度:

    pip install django -i https://pypi.tuna.tsinghua.edu.cn/simple
    

    国内常用镜像源还有阿里云、网易等,替换上述链接即可。

  • 配置pip永久使用国内镜像源
    Windows系统操作步骤:

    1. 在用户目录(如C:\Users\HP)下创建pip文件夹
    2. 在该文件夹内新建pip.ini文件,写入以下内容:
    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    

    配置完成后,后续所有pip安装操作都会默认使用该镜像源。

  • 延长pip超时时间
    如果不想更换源,可通过参数延长下载超时时间,给足下载缓冲:

    pip install django --default-timeout=100
    

    数值代表超时秒数,可根据网络情况调整。

  • 手动下载包后本地安装

    1. 找到对应版本的Django安装包(优先选择.whl格式)
    2. 下载到本地后,执行本地安装命令:
    pip install C:\路径\到\下载的\Django-x.x.x-py3-none-any.whl
    

内容的提问来源于stack exchange,提问作者Patrick Adah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 09:54:14