解决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/
相关推荐
摘星编程3 小时前
CANN内存管理机制:从分配策略到性能优化
人工智能·华为·性能优化
Moonbeam Community3 小时前
Polkadot 2025:从协议工程到可用的去中心化云平台
大数据·web3·去中心化·区块链·polkadot
likerhood3 小时前
3. pytorch中数据集加载和处理
人工智能·pytorch·python
Robot侠3 小时前
ROS1从入门到精通 10:URDF机器人建模(从零构建机器人模型)
人工智能·机器人·ros·机器人操作系统·urdf机器人建模
haiyu_y4 小时前
Day 46 TensorBoard 使用介绍
人工智能·深度学习·神经网络
阿里云大数据AI技术4 小时前
DataWorks 又又又升级了,这次我们通过 Arrow 列存格式让数据同步速度提升10倍!
大数据·人工智能
做科研的周师兄4 小时前
中国土壤有机质数据集
人工智能·算法·机器学习·分类·数据挖掘
IT一氪4 小时前
一款 AI 驱动的 Word 文档翻译工具
人工智能·word
Data_agent4 小时前
京东图片搜索商品API,json数据返回
数据库·python·json
lovingsoft4 小时前
Vibe coding 氛围编程
人工智能