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

相关推荐
xcLeigh14 小时前
Python入门:Python3 operator模块全面学习教程
开发语言·python·学习·教程·python3·operator
xcLeigh14 小时前
Python小游戏实战:实现2048游戏小游戏附源码
python·游戏·教程·pygame·2048·python3
大叔带刺14 小时前
使用python创建自己的专属星座签名APP:Name2Constell
开发语言·python·pygame
weixin_4684668514 小时前
Markitdown 文档解析快速入门指南
开发语言·python·自动化·编程
我材不敲代码14 小时前
Python基础:注释的写法(单行、多行、文档注释)
服务器·python·microsoft
海鸥-w14 小时前
前端学python 第一课安装python环境及开发工具下载安装
python
浮生望14 小时前
Prompt Engineering 实战指南:用 DeepSeek API 写出高质量提示词
python·llm
To_OC15 小时前
Python 字典和集合,原来底层是这么玩的
python
星卯教育tony15 小时前
CIE中国电子学会2026年3月c++ Python scratch 机器人真题试卷含参考答案
c++·python·scratch·电子学会
linksinke15 小时前
在 CentOS 7.x 外网环境离线构建便携式 Python 3.11.4 的方案参考
linux·python·centos