Anaconda3 windows 下设置代理来获取包

        Anaconda 是一个用于科学计算的 Python 发行版,支持 Linux, Mac, Windows, 包含了众多流行的科学计算、数据分析的 Python 包。一般公司为了安全网络连接外网需要设置代理。如果不设置代理,将无法访问anaconda等python包的来源。

        方法一:修改anaconda的配置文件,位置在c:\User(或“用户”)\current_user(当前用户)\.condarc 下,增加如下内容:

channels:
  - http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

show_channel_urls: true
allow_other_channels: true

proxy_servers:
  http: http://username:password@xx.xx.xx.xx:port
  https: http://username:password@xx.xx.xx.xx:port

ssl_verify: true
 

上述方法没有成功,无法联网获取包的来源。

          方法二:pip命令中加参数:pip --proxy http://XXXXX.com:端口, 其中代理是公司提供的IP地址和端口,如果需要账号验证,格式为:pip --proxy   http://username:password@xx.xx.xx.xx:port

          打开Anaconda Prompt,输入名利  pip --proxy   http://username:password@xx.xx.xx.xx:port  install pyinstaller

          发现仍然会报错,遇到There was a problem confirming the ssl certificate...的提示:

           这是因为国内墙的问题,可以使用就近的地址下载:
                       pip install xx -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

           最后的命令:pip --proxy   http://username:password@xx.xx.xx.xx:port  install pyinstaller  -i https://mirrors.aliyun.com/pypi/simple/      

            上述方法可以解决问题。

            备注:以上大部分内容参考网络。

          

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值