如何修改anaconda的文件目录_关于anaconda环境conda/pip install 报SSL错误问题(有两种情况)...

当anaconda环境下,安装/更新 python包(conda/pip install package)出现如下错误:

An HTTP error occurred when trying to retrieve this URL.HTTP errors are often intermittent, and a simple retry will get you on your way.SSLError(MaxRetryError('HTTPSConnectionPool(host='http://conda.anaconda.org', port=443): Max retries exceeded with url: /bioconda/linux-64/repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",))',),)

此错误,在Ubuntu、windows、mac等都可能出现,很多解决方案归咎为不能访问官网镜像问题,其实有两个问题会报上面错误,所以解决方法也分为两种:

解决方法一:镜像问题

将其设置为国内(清华大学)

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

以上脚本,是修改 ~/.condarc 文件的 channels 配置,因此你也可以直接打开该文件进行设置(上面操作等同于下面两步骤操作):

windows在 C:Users你的电脑名. condarc
@xsx 评论提到,若仍出现SSLError,https替换http;
替换前移除此前加入的镜像源(重置):conda config --remove-key channels

打开 ~/.condarc 文件,将

channels:
  - default
show_channel_urls: flase

修改为:

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

设置完成。

若需换回默认官网镜像源

$ conda config --remove-key channels

如果需要代理,在 ~/.condarc 加入如下代码

proxy_servers:
    http: http://127.0.0.1:9001
    https: https://127.0.0.1:9001
注意 http: 与下一个 http: 需要空格,首个 http: 对齐去其他相同,需要两个空格,参考点击 此处;

解决方法二:环境变量问题

如果安装 报开头的错误,那么很可能是此问题,而 问题一 是请求超时,在等待相当一段时间才报错;

参考解决方案

CondaHTTPError: HTTP None None for url <https://repo.continuum.io/pkgs/free/win-64/repodata.json.bz2><br>Elapsed: None<br><br>An HTTP error occurred when trying to retrieve this URL.<br>HTTP errors are often intermittent, and a simple retry will get you on your way.<br>ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005E606A0>, 'Connection to repo.continuum.io timed out. (connect timeout=9.15)'))",),)<br>Navigator Error · Issue #2760 · ContinuumIO/anaconda-issues​github.com
f73ae89b16525b54c1538ee4e0016366.png

解决方案描述如下:

%CONDA_HOME% was set to /path/to/Anaconda3

And "%CONDA_HOME%" as well as "%CONDA_HOME%Scripts" was added before.

To overcome the error, I had to add "%CONDA_HOME%Librarybin" to path.

Now it works perfectly

解决方案很简单,就是增加几个 anaconda路径,在系统变量path加入 anaconda路径

D:anaconda3
D:anaconda3Scripts
D:anaconda3Librarybin
D:anaconda3 anaconda 安装路径
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值