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日更新)-騰訊云開發者社區-騰訊云 ??