https://docs.conda.io/projects/conda/en/stable/
These quick command line instructions will get you set up quickly with the latest Miniconda installer. For graphical installer (.exe and .pkg) and hash checking instructions, see Installing Miniconda.
These four commands quickly and quietly install the latest M1 macOS version of the installer and then clean up after themselves. To install a different version or architecture of Miniconda for macOS, change the name of the .sh installer in the curl command.
mkdir -p ~/miniconda3
curl [<https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh>](<https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh>) -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
After installing, initialize your newly-installed Miniconda. The following commands initialize for bash and zsh shells:
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh
conda 是一个流行的包管理器,主要用于管理 Python 包和环境,特别是在数据科学和机器学习领域。以下是如何使用 conda 的基本指南:
安装 conda:
conda 主要通过安装 Anaconda 或 Miniconda 来获得。
创建新的环境:
conda create --name myenv python=3.8
这将创建一个名为 myenv 的新环境,并安装 Python 3.8。
激活环境:
在 Windows 上:
activate myenv
在 macOS 和 Linux 上:
conda activate myenv
安装包:
conda install numpy pandas matplotlib
这将在当前激活的环境中安装 numpy、pandas 和 matplotlib。
查看已安装的包:
conda list
更新包:
conda update numpy
卸载包:
conda remove numpy
创建环境的克隆:
conda create --name myclone --clone myenv
导出环境为 YAML 文件:
conda env export > environment.yml
这将使得他人可以复制你的环境。
从 YAML 文件创建环境:
conda env create -f environment.yml