pip install换源

本文介绍了如何更换Pypi源以解决因默认国外源不稳定导致的问题。提供了多种国内镜像源的配置方法,包括直接指定源地址进行安装及修改Python安装目录下的源地址等。此外还涉及了Anaconda清华镜像的配置步骤。

pypi换源总结

由于pypi源默认为国外源,经常被墙导致不可用,所以安装软件时pip源最好更换为国内资源

常用国内源:

豆瓣:https://pypi.douban.com/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple

使用方法

直接使用:
在安装软件时使用带源地址的安装方法,以安装keras为例输入如下命令:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple keras

更换python安装目录下的源地址:将…\Lib\site-packages\pip\models\index.py文件中的PyPI值修改为你希望的国源链接。如将其修改为清华源:

注释掉:PyPI = Index(‘https://pypi.python.org/’)
修改源:PyPI = Index(‘https://pypi.tuna.tsinghua.edu.cn/simple’)

修改后安装keras命令:pip install keras

Anaconda 清华镜像使用

参考: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda
运行以下命令:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

Python2 to Python3

python安装路径下,已有转换执行程序2to3.exe
转换命令

2to3 --output-dir=python3-version -W -n python2-version

pip install 未安装到虚拟环境中

activate envs
python -m pip install onnxruntime-gpu==1.16.3 -i https://pypi.tuna.tsinghua.edu.cn/simple

Git 仓库拉取第三方库编译源码

git clone --depth 1 --branch dev-1.x --recursive https://github.com/open-mmlab/mmdeploy.git
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值