# shell 载入
if [[ "~/opt/miniconda3" ]]; then
export PATH=$PATH:~/opt/miniconda3/bin
fi
# 不会每次进入 shell 的时候载入 base 环境
conda config --set auto_activate_base false
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
.condarc
里查看镜像
# 列出所有环境
> conda env list
# 创建环境
# conda create --name [env name] [python version] [need package]
> conda create --name math python=3.9
# 激活
> conda init zsh
# 关闭 shell 后
> conda activate math
# shell 前出现 (math) 标识
(math) ➜ >
# 退出 conda 环境
(math) ➜ > conda deactivate
# 删除 conda 环境
> conda remove -n [env name] --all
# 重命名环境 - 先复制再删除
> conda create -n new_env_name --clone math
> conda remove -n math --all
# 指定版本
# conda install [package] = [version]
(math) ➜ > conda install pandas = 1.26.0
# 查看已安装软件
(math) ➜ > conda list
# 更新
(math) ➜ > conda update [package]
# 删除
(math) ➜ > conda remove [package]
在 conda 环境中,还需要使用 pip
conda 本身只提供部分包,远远没有 pip 的多。
这时候就要使用 pip 安装包。
> pip install numpy==1.93
还可以在 create conda env 后,直接使用
pip install -r requirements.txt
安装所有依赖。现在我的方案是,把 conda 当作 pyenv 用,只用来隔离 Python 环境。
包的管理,使用 pip 来做。