Windows pip install -r requirements.txt 太慢

目录

解决方案一:

解决方案二:

下载单个包时切换源:


解决方案一:

1、在虚拟环境中切换下载的源:

复制代码
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

2、当出现有pip.txt文件写入时,再执行pip安装

复制代码
pip install -r requirements.txt 

解决方案二:

1、在 C:\Users\All Users目录下创建pip文件夹,pip文件中创建pip.ini文件

2、编辑文件内容:

复制代码
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

一些镜像地址:

清华大学: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/

3、再进行安装

复制代码
pip install -r requirements.txt 

下载单个包时切换源:

复制代码
pip install somepackage -i https://pypi.tuna.tsinghua.edu.cn/simple/

执行pip install -r requirements.txt 时'gbk'报错:

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa8 in position 187: illegal multibyte sequence

解决方法:

单击上图绿色的路径(错误信息中的文件:lib\site-packages\pip_internal\utils\encoding.py) ,找到报错的行,给decode函数添加参数'ignore',:

相关推荐
leisoo80973 小时前
100GBA股股票数据怎么存ClickHouseRedisMySQLJSON完整对比
大数据·linux·服务器·开发语言·python
WangYan20224 小时前
基于XGBoost与AI的生态—地学多源数据建模:植被与土地利用识别、土壤碳氮空间预测、生物多样性驱动机制、土壤微生物功能预测、生态退化与风险识别
python·机器学习·xgboost
金銀銅鐵6 小时前
[Python] 借助 turtle 逐字展示唐诗《金缕衣》
python
Python大数据分析@8 小时前
使用大模型MCP采集数据,爬虫已经无门槛
python·网络爬虫
quantdash_cc8 小时前
告别自建 Requests/BS4 网页爬虫:基于 QuantDash 搭建零维保的高性能量化行情流水线
开发语言·爬虫·python·pandas·量化·quantdash
65岁退休Coder8 小时前
LangChain v1.3.4 笔记 - 07 补充:链式调用 LCEL
后端·python·langchain
卷无止境9 小时前
FastAPI 部署在 Nginx 后面到底该怎么配
后端·python
半亩码田9 小时前
C#转Python第3.1篇:Python 的 class 没有访问修饰符?面向对象的另一条路
开发语言·python·c#
Wzx1980129 小时前
python沙箱和docker沙箱你选对了吗?
开发语言·python·docker
Python私教10 小时前
签名 URL 刷新导致审批失效?别急着删掉所有 query
python·安全