【CentOS --- CondaHTTPError: HTTP 000 CONNECTION FAILED 】

question:在这里插入代码片

hangsan@localhost ~]$ conda create -n wen python=3.6
Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url
 <https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2>
Elapsed: -

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.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.
io', port=443): Max retries exceeded with url: /pkgs/free/linux-64/repodata.json.bz2 
(Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object 
at 0x7f4e54a366d8>: Failed to establish a new connection: [Errno -2] 
Name or service not known',))",),)

Normal Linux configuration file

# .bashrc
 
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
 
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
 
# User specific aliases and functions
 
# added by Anaconda3 installer
export PATH="/home/xiaotian(用户名)/anaconda3/bin:$PATH"  
alias python="~/anaconda3/bin/python3"
alias python3=python
alias pip="~/anaconda3/bin/pip"
alias pip3=pip
alias conda="~/anaconda3/bin/conda"


更改:  sudo gedit ~/.bashrc
保存:  source ~/.bashrc

solve;

1. Versions before centos7 can open and close the firewall through iptables related commands

  • 1. First, you can use iptables --help to view the help command in the open terminal;

  • 2. Check the status of the firewall: service iptables status (this command can check whether the firewall is on or off);

  • 3. Service iptables common parameters:

    -(1) service iptables stop to close the firewall;

    -(2) service iptables start to enable the firewall;

    -(3) service iptables reload reloads the firewall;

    -(4) service iptables restart to restart the firewall;

  • 4. Permanently turn off/on the firewall

    • chkconfig iptables off permanently turns off the firewall;

    • chkconfig iptables on permanently open the firewall;
      —————————————————

Students who can’t ping the network:
1. Turn off the firewall of linux (search online by yourself)
2. In the virtual network editor in vmware, set the subnet IP (same as the system IP number segment) and gateway IP (same as the system gateway )
insert image description here

insert image description here
Example configuration for mirroring


Extras:

firewall

查看已经开放的端口

firewall-cmd --list-ports 
 
开启端口

firewall-cmd --zone=public --add-port=80/tcp --permanent  

命令含义:
–zone #作用域
–add-port=80/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
关闭端口

firewall-cmd --zone=public --remove-port=3306/tcp --permanent
 

开启端口后记得重启

firewall-cmd --reload

或者

systemctl restart firewalld
 
防火墙其他命令

# 开启防火墙
systemctl start firewalld

#停止firewall  
systemctl stop firewalld 

#重启防火墙
systemctl restart firewalld

#firewall开机启动  
systemctl enable firewalld

#禁止firewall开机启动  
systemctl disable firewalld

In | .condarc | write can change downloaded mirror, speed up pip

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud



Second solution

How to solve conda create -n name python=3.6

question

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/repodata.json>
Elapsed: -
 
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=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/pkgs/free/linux-64/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')],)",),))',),)


-----------------------------------------------------


上述不通  可执行下面这个

在ubuntu 的home 目录下,ctrl+h,显示所有隐藏文件,打开.condarc文件, 或终端

gedit ~/.condarc 

---------------------------------

ssl_verify: true
show_channel_urls: true
 
channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/


insert image description here

Guess you like

Origin blog.csdn.net/qq_42700796/article/details/125725045