ome*_*rbp 49 proxy python-2.7 anaconda
我在Windows上使用Anaconda 2.7,我的网络连接使用代理.
以前,当使用python 2.7(Not Anaconda)时,我安装了这样的包:
pip install {packagename} --proxy proxy-us.bla.com:123
Run Code Online (Sandbox Code Playgroud)
有没有办法运行conda代理参数?没有看到它conda help.
谢谢
asm*_*rer 51
您可以通过将代理添加到conda来配置代理.condarc,例如
proxy_servers:
http: http://user:pass@corp.com:8080
https: https://user:pass@corp.com:8080
Run Code Online (Sandbox Code Playgroud)
或者设置HTTP_PROXY和HTTPS_PROXY环境变量.请注意,在您的情况下,您需要将方案添加到代理URL,如https://proxy-us.bla.com:123.
请参阅http://conda.pydata.org/docs/config.html#configure-conda-for-use-behind-a-proxy-server.
su7*_*u7k 33
或者您可以使用4.4.x版本中的命令行.
conda config --set proxy_servers.http http://id:pw@address:port
conda config --set proxy_servers.https https://id:pw@address:port
Run Code Online (Sandbox Code Playgroud)
小智 10
我犯的一个错误是将文件保存为a.condarc或b.condarc.
将其另存为.condarc并将以下代码粘贴到文件中,并将文件保存在主目录中.对主机名,用户等进行必要的更改
channels:
- defaults
show_channel_urls: True
allow_other_channels: True
proxy_servers:
http: http://user:pass@hostname:port
https: http://user:pass@hostname:port
ssl_verify: False
Run Code Online (Sandbox Code Playgroud)
小智 5
我无需输入用户名和密码即可使其正常工作:
conda config --set proxy_servers.https https://address:port
Run Code Online (Sandbox Code Playgroud)
我解决的最好方法是在使用conda或pip安装/更新命令之前设置代理环境变量。只需运行:
set HTTP_PROXY=http://username:password@proxy_url:port
Run Code Online (Sandbox Code Playgroud)
例如,您的实际命令可能类似于
set HTTP_PROXY=http://yourname:your_password@proxy.your_company.com:8080
Run Code Online (Sandbox Code Playgroud)
如果您的公司使用 https 代理,那么也
set HTTPS_PROXY=https://username:password@proxy_url:port
Run Code Online (Sandbox Code Playgroud)
一旦您退出 Anaconda 提示,此设置就会消失,因此您的用户名/密码不会在会话后保存。
我没有选择Anaconda 文档或其他一些来源中提到的其他方法,因为它们都需要将用户名/密码硬编码到
.condarc或.netrc配置文件(这也不适用于 PIP)所有这些都是不安全的,以后需要不断更新。如果您忘记在哪里更新?更多的故障排除会出现在您的面前...