anaconda、miniconda、conda的关系及miniconda安装
anaconda、miniconda、conda的关系及miniconda安装
文章目录
- 前言
- 正文
- 定义
- 关系
- Linux安装miniconda
- 新建一个python3.8环境
- 参考
前言
本文用于记录关于Anaconda、conda和Miniconda的定义及其关系的总结123:
正文
定义
- conda
- 一个跨平台的开源包管理和环境管理工具,支持多种编程语言(不仅是Python),可以安装、更新、删除软件包,并管理不同版本的Python环境。
- 核心功能包括:
- 包管理:类似
pip
,但能处理非Python依赖项(如C/C++库)。 - 环境隔离:创建独立环境以避免版本冲突,例如同时管理Python 2和Python 3项目。
- 包管理:类似
- Anaconda
- Python科学计算发行版,预装了conda、Python解释器和180+科学计算库(如NumPy、Pandas、Jupyter等),适合数据分析、机器学习等场景。
- 特点:
- 开箱即用,省去手动配置依赖的麻烦。
- 包含图形化界面工具(如Anaconda Navigator)。
- 体积较大(约3GB),适合存储空间充足的用户。
- Miniconda
- Anaconda的轻量级版本,仅包含conda工具、Python基础环境和必要依赖,不预装其他科学计算库。
- 特点:
- 体积小(约50MB),适合对存储敏感或需要自定义环境的用户。
- 用户可通过
conda install
按需安装特定包。
关系
- 层级关系
- conda是底层工具,被集成到Anaconda和Miniconda中,负责包和环境管理的核心功能。
- Anaconda和Miniconda是发行版:
- Anaconda = conda + Python + 预装科学计算库 + 图形化工具。
- Miniconda = conda + Python + 基础依赖。
- 选择建议
- 选Anaconda:需要快速开始科学计算项目,且无需手动配置常用库。
- 选Miniconda:希望最小化安装,或需灵活控制环境(如深度学习框架的多版本切换)。
概览对比表格:
特性 | conda | Anaconda | Miniconda |
---|---|---|---|
核心功能 | 包与环境管理 | 科学计算发行版(含conda) | 精简版发行版(含conda) |
预装内容 | 无 | 180+科学库、图形工具 | 仅conda和Python |
体积 | 不适用(集成在发行版) | 约3GB | 约50MB |
适用场景 | 需通过发行版使用 | 数据分析、机器学习初学者 | 自定义环境开发、资源受限场景 |
Linux安装miniconda
- 下载miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
- 运行安装脚本
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh...# 输出及处理:敲回车
Please, press ENTER to continue
>>> ...# 确认版权
Do you accept the license terms? [yes|no]
>>> yes...# 敲回车即可
Miniconda3 will now be installed into this location:
/home/dev/miniconda3- Press ENTER to confirm the location- Press CTRL-C to abort the installation- Or specify a different location below...# 敲回车、默认为no
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:eval "$(/home/dev/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)" To install conda's shell functions for easier access, first activate, then:conda initThank you for installing Miniconda3!
# 至此安装结束
新建一个python3.8环境
$ conda create --name xCorePy python=3.8Channels:- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done## Package Plan ##environment location: /home/dev/miniconda3/envs/xCorePyadded / updated specs:- python=3.8The following packages will be downloaded:package | build---------------------------|-----------------pip-24.2 | py38h06a4308_0 2.2 MBpython-3.8.20 | he870216_0 23.8 MBsetuptools-75.1.0 | py38h06a4308_0 1.7 MBwheel-0.44.0 | py38h06a4308_0 108 KB------------------------------------------------------------Total: 27.8 MBThe following NEW packages will be INSTALLED:_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main _openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu ca-certificates pkgs/main/linux-64::ca-certificates-2025.2.25-h06a4308_0 ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.40-h12ee557_0 libffi pkgs/main/linux-64::libffi-3.4.4-h6a678d5_1 libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 openssl pkgs/main/linux-64::openssl-3.0.16-h5eee18b_0 pip pkgs/main/linux-64::pip-24.2-py38h06a4308_0 python pkgs/main/linux-64::python-3.8.20-he870216_0 readline pkgs/main/linux-64::readline-8.2-h5eee18b_0 setuptools pkgs/main/linux-64::setuptools-75.1.0-py38h06a4308_0 sqlite pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0 tk pkgs/main/linux-64::tk-8.6.14-h39e8969_0 wheel pkgs/main/linux-64::wheel-0.44.0-py38h06a4308_0 xz pkgs/main/linux-64::xz-5.6.4-h5eee18b_1 zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1 Proceed ([y]/n)? yDownloading and Extracting Packages:Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate xCorePy
#
# To deactivate an active environment, use
#
# $ conda deactivate
常用指令如下:
conda activate xCorePy # 激活虚拟环境
conda deactivate # 离开虚拟环境
conda env list # 列出虚拟环境
conda info --envs # 列出虚拟环境
conda env remove -n xCorePy # 删除虚拟环境
配置镜像仓库加速(任意即可)4:
# 阿里云
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
# 清华云
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 中科大云
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
# 腾讯云
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple
# 华为云
pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple
参考
在 Linux 上安装 Miniconda_linux安装miniconda-CSDN博客 ↩︎
[Python] conda、anaconda、miniconda的关系,miniconda安装,conda命令使用_miniconda和anocanda-CSDN博客 ↩︎
Anaconda常用命令总结,anaconda、conda、miniconda的关系、pip镜像源的处理_anaconda miniconda-CSDN博客 ↩︎
2025最新 pip install 国内可用镜像源仓库地址(01月01日更新)-腾讯云开发者社区-腾讯云 ↩︎