解决Anaconda出现CondaHTTPError: HTTP 000 CONNECTION FAILED for url

解决Anaconda出现CondaHTTPError: HTTP 000 CONNECTION FAILED for url

第一类情况

在anaconda创建新环境时,使用如下代码

复制代码
conda create -n charts python=3.7

错误原因:

默认镜像源访问速度过慢,会导致超时从而导致更新和下载失败。

解决方案:

方法1:更换镜像源为清华镜像源,并且删除默认镜像源。

首先执行如下几条命令更换清华镜像源

bash 复制代码
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

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

如果无法运行成功:

镜像URL要是https改为http

更改镜像源配置文件

然后在"C:\Users\Administrator(你的用户名)"目录下找到".condarc"文件并打开,若channels下面有-default,删除-default,保存即可

使用pycharm或者命令行中的conda创建虚拟环境,并且耐心等待即可

方法2:先用vim打开./condarc文件,然后手动添加源

bash 复制代码
#open .condarc file
vi /home/xuran/.condarc
 
#add the following code
ssl_verify: true
channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
bash 复制代码
show_channel_urls: true

第二类情况:

抓包的时候开了代理,只要在浏览器设置里关掉代理就可以了

【常见模块错误】

如果出现模块错误

python 复制代码
进入控制台输入:建议使用国内镜像源

pip install 模块名称 -i https://mirrors.aliyun.com/pypi/simple

我大致罗列了以下几种国内镜像源:

清华大学
https://pypi.tuna.tsinghua.edu.cn/simple
     
阿里云
https://mirrors.aliyun.com/pypi/simple/
     
豆瓣
https://pypi.douban.com/simple/
     
百度云
https://mirror.baidu.com/pypi/simple/
     
中科大
https://pypi.mirrors.ustc.edu.cn/simple/
     
华为云
https://mirrors.huaweicloud.com/repository/pypi/simple/
     
腾讯云
https://mirrors.cloud.tencent.com/pypi/simple/
相关推荐
鬼手爱剪辑1 小时前
短剧AI 配音技术的难点、原理、开源和闭源软件汇总-2026 年
人工智能
田里的水稻1 小时前
PyTorch_Dataloader\TensorBoard---数据加载与可视化
人工智能·pytorch·python·神经网络·机器学习
9527出列2 小时前
基于oss的断点续传实现
http·性能优化
Dmz丶2 小时前
前端转 AI 100 天 Day 27:Docker 容器化——从“我电脑能跑“到“到处能跑“
python
万年咸鱼2 小时前
HTTPS 是如何保证传输安全的?
网络协议·安全·https
卿卿的产品经理日记2 小时前
【AI产品经理实战】Day 38|try-except 踩坑实录:报错是数据
人工智能·笔记·python·学习·产品经理
cxj75142 小时前
GEO 工程化实践:关键页面的快慢双轨更新与多引擎引用维护
人工智能·geo·geo优化
Java_AI工程师2 小时前
Spring4 / SpringBoot1.x 老项目想接入 AI?不用升级框架!3 套无痛落地方案
java·人工智能·spring boot
大大大大晴天2 小时前
每天认识一个组件:Elasticsearch
大数据
znnnk2 小时前
【AI技术】Vibe Coding 实践指南:从项目规划到高效开发
人工智能·ai·ai编程·ai ide·vibe coding