anaconda设置代理以及添加镜像源

公司为了安全,网络连接外网需要设置代理。因此,如果不设置代理,将无法访问anaconda等python包的来源。进行如下操作:

1.打开Anaconda Prompt,先添加国内镜像源

在这里插入图片描述
一些国内镜像源:

  阿里云 https://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/

添加镜像源命令:

conda config --add channels https://mirrors.aliyun.com/pypi/simple/

查看添加的镜像:
conda config --get channels

2.设置可以使用pip访问包管理,执行如下命令:

conda config --set use_pip True

3.修改anaconde的配置文件.condarc,一般在如下目录:

在这里插入图片描述
C:\Users\18030501.condarc

4.将如下内容写入.condarc文件:

其中host:port为ip+端口,若公司代理是域名,那就是域名+端口(xxx.com:port)

proxy_servers:
    http: http://host:port
    https: http://host:port

参考:
https://stackoverflow.com/questions/29267646/how-to-enable-proxy-servers-with-anaconda-python

猜你喜欢

转载自blog.csdn.net/qq_27466827/article/details/84099807