pip、Anaconda更改国内源以及为当前用户安装

国内源

清华源: https://pypi.tuna.tsinghua.edu.cn/simple
科大源: https://pypi.mirrors.ustc.edu.cn/simple

临时更改

可以在使用pip的时候加参数-i https://pypi.mirrors.ustc.edu.cn/simple

例如:pip install -i https://pypi.mirrors.ustc.edu.cn/simple numpy,从科大镜像安装numpy库

永久更改

编辑 ~/.pip/pip.conf 文件(如果没有则创建之),修改内容为:

[global] 
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
format = columns

给当前用户安装

安装时加上 —user参数即可
如:
pip install --user numpy

这样就只将numpy安装到当前用户的目录里了

Anaconda 科大源

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

欢迎关注 DataLearner 官方微信,获得最新 AI 技术推送

DataLearner 官方微信二维码