在一台 Linux 服务器上配置新的CONDA环境时偶然发现这个问题,把解决的历程记录一下。
开始查结果说是代理问题。但按网上步骤把浏览器Internet设置中的代理关掉依然不行。
$ conda create -n artemis python=3.6.9
Collecting package metadata (current_repodata.json): failed
ProxyError: Conda cannot proceed due to an error in your proxy configuration. Check for typos and other configuration errors in any ‘.netrc’ file in your home directory, any environment variables ending n ‘_PROXY’, and any other system-wide proxy configuration settings.
想到可能是环境变量的问题,查看env | grep -i "_PROXY"
后发现果然被调整过相关设置。
$ env | grep -i "_PROXY"
http_proxy=http://127.0.0.1:12333
https_proxy=http://127.0.0.1:12333
但按照通过配置bachrc
文件解决这个问题的经验分享[1],正确更改bashrc
文件配置环境变量[2],不仅无法解决我的问题,还在source ~/.bashrc
时发现了command not found
的错误。
经过另一则博客启发[3],想到这台服务器可能使用的zsh
,遂通过修改zshrc
文件方式的进行修改,这回source ~/.zshrc
成功,但依然会显示有_PROXY
设置。
最后,想到有没有办法不改这些,直接取消代理设置:
$ unset http_proxy && unset https_proxy
关掉后,验证env | grep -i "_PROXY"
,果然不再有输出。环境也可以正常安装了。
完工~
[1] https://blog.youkuaiyun.com/littlehaes/article/details/103518285
[2] https://blog.youkuaiyun.com/yiminghd2861/article/details/98854882
[3] https://blog.youkuaiyun.com/qq_36148847/article/details/79261067