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:[email protected]:port
  https: http://username:[email protected]:port

ssl_verify: true
 

上述方法沒有成功,無法聯網獲取包的來源。

 

          方法二:pip命令中加參數:pip --proxy http://XXXXX.com:端口, 其中代理是公司提供的IP地址和端口,如果需要賬號驗證,格式爲:pip --proxy   http://username:[email protected]:port

          打開Anaconda Prompt,輸入名利  pip --proxy   http://username:[email protected]: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:[email protected]:port  install pyinstaller  -i https://mirrors.aliyun.com/pypi/simple/      

            上述方法可以解決問題。

            備註:以上大部分內容參考網絡。

          

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章