pip如何配置国内高速镜像

全局范围内设置 pip 的镜像源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set global.index-url http://pypi.hustunique.com/
pip config set global.index-url http://pypi.sdutlinux.org/
pip config set global.index-url http://pypi.douban.com/simple/

当前用户设置 pip 的镜像源

pip config set index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set index-url https://mirrors.ustc.edu.cn/pypi/web/simple
pip config set index-url https://mirrors.aliyun.com/pypi/simple/

单次下载使用镜像源

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

pip的源管理

#显示目前pip的数据源有哪些
pip config list
pip config list --[user|global] # 列出用户|全局的设置
pip config get global.index-url # 得到这key对应的value 如:https://mirrors.aliyun.com/pypi/simple/

# 添加
pip config set key value
#添加数据源:例如, 添加USTC中科大的源:
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
#添加全局使用该数据源
pip config set global.trusted-host https://mirrors.ustc.edu.cn/pypi/web/simple

# 删除
pip config unset key
# 例如
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

#搜索
pip search flask  #搜素flask安装包

# 升级pip
pip install pip -U

pip的源

阿里云                   http://mirrors.aliyun.com/pypi/simple/
中国科技大学         		https://pypi.mirrors.ustc.edu.cn/simple/ 
豆瓣(douban)         	http://pypi.douban.com/simple/ 
清华大学                	https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学  			http://pypi.mirrors.ustc.edu.cn/simple/
Python官方               https://pypi.python.org/simple/
v2ex                    http://pypi.v2ex.com/simple/
中国科学院                http://pypi.mirrors.opencas.cn/simple/
华中理工大学              http://pypi.hustunique.com/
山东理工大学              http://pypi.sdutlinux.org/

pip的基本操作

pip list 							#列出当前缓存的包
pip purge 							#清除缓存
pip remove 							#删除对应的缓存
pip help 							#帮助
pip install xxx 					#安装xxx包
pip install xxx.whl					#安装xxx.whl本地包
pip install -r requirements.txt 	#批量安装
pip uninstall xxx 					#删除xxx包
pip show xxx 						#展示指定的已安装的xxx包
pip check xxx 						#检查xxx包的依赖是否合适
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

githubcurry

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值