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 天前
华为笔试0429
python·numpy
Warson_L1 天前
Dictionary
python
寒山李白1 天前
解决 python-docx 生成的 Word 文档打开时弹出“无法读取内容“警告
python·word·wps·文档·docx·qoder
林浩杨1 天前
Pip对当前环境下的所有包进行更新
pip
2401_832365521 天前
JavaScript中rest参数(...args)取代arguments的优势
jvm·数据库·python
Sirius.z1 天前
第J3周:DenseNet121算法详解
python
2301_779622411 天前
Go语言怎么用信号量控制并发_Go语言semaphore信号量教程【入门】
jvm·数据库·python
2301_766283441 天前
c++如何将控制台输出保存到文件_cout重定向到txt【详解】
jvm·数据库·python
小康小小涵1 天前
基于ESP32S3实现无人机RID模块底层源码编译
linux·开发语言·python
lzjava20241 天前
Python的函数
开发语言·python