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',:

相关推荐
张张123y3 分钟前
Hermes Agent 是什么?它能做什么,以及如何部署到飞书
人工智能·python·飞书
SamChan9011 分钟前
用Playwright端到端测试PDF翻译功能:Web自动化测试实战
前端·python·ai·pdf·wpf
袁袁袁袁满21 分钟前
Python爬虫实战:利用巨量IP获取跨境电商数据
爬虫·python·网络爬虫·爬虫实战·跨境电商·电商爬虫
jufeng130733 分钟前
【系列:TDengine 工业物联网实战:从零搭起可运行系统 · 第 4 篇】
python·时序数据库·tdengine·asyncio
努力搬砖的咸鱼38 分钟前
意图理解:让Agent从需求描述自动生成Pytest测试策略
人工智能·python·ai·单元测试·pytest·agent
2601_956319881 小时前
2026年下半年,量化学习要把交易认知和技术实现接起来
人工智能·python
EW Frontier1 小时前
【雷达信号处理】5 个阵元追平 16 个阵元:稀疏阵列 STAP 的实测报告【附python+matlab代码】
python·matlab·信号处理·雷达·mimo·稀疏阵列·stap
卷无止境1 小时前
FastAPI的测试事件在测什么?
后端·python·fastapi
selfsongs1 小时前
Python学习之——multiprocessing 多进程编程
python
卷无止境1 小时前
FastAPI CLI 你需要认识这把命令行利器
后端·python·fastapi