An error occurred when creating a python virtual environment on Linux: requests.exceptions.HTTPError: 404 Client Error/ An unexpected error has occurred

1 Problem description

Install the conda virtual environment on Linux and execute the command

conda create -n 环境名 python=3.8

When, the error is reported as follows:

Insert image description here
Insert image description here

At first I thought it was a problem with the mirror source, so I deleted the original mirror source, added a new one, or changed http to https, etc. to no avail. Later I discovered that the problem was not with the mirror source. My mirror source was the one from Tsinghua University: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64

2 Solve the problem

First execute the command in the Linux system:

~/.condarc

Find the location of the .condarc file:

Insert image description here
Then delete the .condarc file:

rm /home/amax/.condarc

Continue executionconda create -n 环境名 python=3.8 and you will be able to successfully create a new environment~

You can executeconda info --envs to view the new virtual environment created.

The final content of the entire command line:

conda create -n myname python=3.8  # 创建虚拟环境
conda info --envs # 显示虚拟环境
conda activate myname # 进入虚拟环境
pip install xxx # 安装所需要的包
conda deactivate  # 退出虚拟环境

Main reference: https://zhuanlan.zhihu.com/p/611508539

Guess you like

Origin blog.csdn.net/summertime1234/article/details/130715849