Anaconda是什么?

在这里插入图片描述
Anaconda指的是一个开源的Python发行版本,其包含了conda、Python等180多个科学包及其依赖项。 因为包含了大量的科学包,Anaconda 的下载文件比较大(约 531 MB),如果只需要某些包,或者需要节省带宽或存储空间,也可以使用Miniconda这个较小的发行版(仅包含conda和 Python)。
Anaconda安装好之后,会在开始目录下创建下面几个应用的快捷方式。

Conda是一个开源的包、环境管理器,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换。

Anaconda包括Conda、Python以及一大堆安装好的工具包,比如:numpy、pandas等;Miniconda包括Conda、Python。

Anaconda启动:

参考文档:
官方文档

Anaconda环境安装问题

问题1:current_repodata.json找不到

新建conda环境报错

C:\Users\Lijx>conda create -n pytorch python=3.7
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/current_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/main/win-64/current_repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

经排查,确认没有这个文件。正确的文件名为:repodata.json

那么,current_repodata.json这个文件究竟是配置在哪里的呢?

C:\Users\Lijx>conda config --show-sources
==> C:\Users\Lijx\.condarc <==
ssl_verify: True
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/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
show_channel_urls: True
解决方案

把路径“Anaconda3/Library/bin“目录下的libcrypto-1_1-x64.dlllibssl-1_1-x64.dll拷贝到“Anaconda3/DLLs”目录下即可。

问题2:ssl模块不可用

网络问题

E:\AIStudy\code\Machine-Learning-for-OpenCV-Second-Edition>conda env create -f environment.yml
Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/win-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=\'conda.anaconda.org\', port=443): Max retries exceeded with url: /conda-forge/win-64/repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))
#首先先添加清华的镜像源
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

需要修改配置文件:condarc,删除-defaults

## windows下:
Anaconda3\pkgs\conda-4.7.12-py37_0\info\test\tests\condarc

修改channels为:

channels:
  - binstar_username
  - http://some.custom/channel
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  - https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
  - https://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/conda

参考内容

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐