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

相关推荐
金銀銅鐵1 小时前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf2 小时前
Agent 流程编排
后端·python·agent
copyer_xyf2 小时前
Agent RAG
后端·python·agent
copyer_xyf2 小时前
【RAG】向量数据库:milvus
后端·python·agent
copyer_xyf3 小时前
Agent 记忆管理
后端·python·agent
星云穿梭18 小时前
用Python写一个带图形界面的学生管理系统——完整教程
python
金銀銅鐵18 小时前
用 Pygame 实现 15 puzzle
python·数学·游戏
黄忠1 天前
大模型之LangGraph技术体系
python·llm
hboot2 天前
AI工程师第二课 - 数据处理
人工智能·python·数据分析
用户8356290780512 天前
使用 Python 自动化 PowerPoint 形状布局与格式设置
后端·python