pip conda 国内镜像源

版权声明:转载请声明 https://blog.csdn.net/qq_23141851/article/details/81436795

当我们在国内时,pip或conda默认源的速度可能很慢,导致下载失败,于是整理了一些国内镜像源。

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/

使用方法为加 -i 加 url,如下(以安装sklearn为例):

pip install -U scikit-learn -i http://pypi.douban.com/simple 

有时会报错,说

The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.

此时请按照提示输入如下命令:

pip install -U scikit-learn -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

如果是使用conda来安装, 执行这两条命令,可以将国内镜像源加入config文件

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

conda config --set show_channel_urls yes

然后再执行即可

conda install scikit-learn

参考:https://www.cnblogs.com/sunnydou/p/5801760.html

https://blog.csdn.net/tangwenbo124/article/details/74784268

猜你喜欢

转载自blog.csdn.net/qq_23141851/article/details/81436795