修改pip源地址

目录

一、国内知名pip源地址

二、针对某次安装包设置pip源地址

三、临时修改pip源配置

四、配置文件永久修改

五、常见问题


一、国内知名pip源地址

复制代码
阿里云 http://mirrors.aliyun.com/pypi/simple/
豆瓣http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
华中科技大学http://pypi.hustunique.com/

二、针对某次安装包设置pip源地址

修改命令如下:

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

三、临时修改pip源配置

修改命令如下:

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

四、配置文件永久修改

新建pip配置文件

复制代码
mkdir  ~/.pip
vi  ~/.pip/pip.conf

pip.conf内容如下:

复制代码
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

五、常见问题

复制代码
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fdcbaaeb7d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/jupyter/
相关推荐
TF男孩9 小时前
ARQ:一款低成本的消息队列,实现每秒万级吞吐
后端·python·消息队列
该用户已不存在14 小时前
Mojo vs Python vs Rust: 2025年搞AI,该学哪个?
后端·python·rust
站大爷IP16 小时前
Java调用Python的5种实用方案:从简单到进阶的全场景解析
python
用户83562907805121 小时前
从手动编辑到代码生成:Python 助你高效创建 Word 文档
后端·python
c8i1 天前
python中类的基本结构、特殊属性于MRO理解
python
liwulin05061 天前
【ESP32-CAM】HELLO WORLD
python
Doris_20231 天前
Python条件判断语句 if、elif 、else
前端·后端·python
Doris_20231 天前
Python 模式匹配match case
前端·后端·python
这里有鱼汤1 天前
Python量化实盘踩坑指南:分钟K线没处理好,小心直接亏钱!
后端·python·程序员
大模型真好玩1 天前
深入浅出LangGraph AI Agent智能体开发教程(五)—LangGraph 数据分析助手智能体项目实战
人工智能·python·mcp