所用平台:ubuntu 18.04
在Anaconda Prompt中输入如下命令:
conda create -n py38 python=3.8
创建新环境时,报错如下:
conda create -n py38 python==3.8
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/pro/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.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/pro/linux-64/repodata.json.bz2 (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')])")))'))
解决办法:
修改其包管理镜像为国内源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
重新新建环境仍旧报错:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-9.1.0-hdf63c60_0.tar.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.
ChunkedEncodingError(ProtocolError('Connection broken: OSError("(104, \'ECONNRESET\')")', OSError("(104, 'ECONNRESET')")))
解决办法:
打开~/.condarc,删除已有内容,加入如下内容:
channels:
- defaults
show_channel_urls: true
ssl_verify: false
report_errors: false
再创建环境,成功
conda create -n py38 python==3.8
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.5.11
latest version: 24.5.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /home/tarena/anaconda3/envs/py38kp
added / updated specs:
- python==3.8
The following packages will be downloaded:
package | build
---------------------------|-----------------
wheel-0.43.0 | py38h06a4308_0 100 KB defaults
pip-24.0 | py38h06a4308_0 2.6 MB defaults
setuptools-69.5.1 | py38h06a4308_0 1.2 MB defaults
------------------------------------------------------------
Total: 3.8 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex: 0.1-main defaults
ca-certificates: 2024.3.11-h06a4308_0 defaults
libedit: 3.1.20210910-h7f8727e_0 defaults
libffi: 3.2.1-hf484d3e_1007 defaults
libgcc-ng: 9.1.0-hdf63c60_0 defaults
libstdcxx-ng: 9.1.0-hdf63c60_0 defaults
ncurses: 6.3-h7f8727e_2 defaults
openssl: 1.1.1w-h7f8727e_0 defaults
pip: 24.0-py38h06a4308_0 defaults
python: 3.8.0-h0371630_2 defaults
readline: 7.0-h7b6447c_5 defaults
setuptools: 69.5.1-py38h06a4308_0 defaults
sqlite: 3.33.0-h62c20be_0 defaults
tk: 8.6.12-h1ccaba5_0 defaults
wheel: 0.43.0-py38h06a4308_0 defaults
xz: 5.2.5-h7f8727e_1 defaults
zlib: 1.2.12-h7f8727e_2 defaults
Proceed ([y]/n)? y
Downloading and Extracting Packages
wheel-0.43.0 | 100 KB | ##################################### | 100%
pip-24.0 | 2.6 MB | ##################################### | 100%
setuptools-69.5.1 | 1.2 MB | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate py38
#
# To deactivate an active environment, use
#
# $ conda deactivate