目录
Ⅰ. conda指令可选参数
1.1 版本信息
1.2 帮助信息
Ⅱ. conda内置指令
2.1 版本更新update
2.2 显示信息info
2.3 配置config
2.4 创建环境create
2.5 激活与退出环境active/deactivate
2.6 安装包install
2.7 删除包或环境remove
2.8 列出包list
2.9 环境env
2.10 查找包search
Ⅰ. conda指令可选参数
options:
-h, --help Show this help message and exit.
--no-plugins Disable all plugins that are not built into conda.
-V, --version Show the conda version number and exit.
1.1版本信息
# 检查 Anaconda 版本:-V, --version
conda -V
1.2帮助信息
# 获取所有指令帮助信息:-h, --help
conda -h
# 查看某一命令的帮助,如 install,env(环境管理相关的帮助):-h, --help
conda install -h
conda env -h
Ⅱ. conda内置指令
COMMAND
build Build conda packages from a conda recipe.
clean Remove unused packages and caches.
compare Compare packages between conda environments.
config Modify configuration values in .condarc.
content-trust Signing and verification tools for Conda
convert Convert pure Python packages to other platforms (a.k.a., subdirs).
create Create a new conda environment from a list of specified packages.
debug Debug the build or test phases of conda recipes.
develop Install a Python package in 'development mode'. Similar to `pip install --editable`.
doctor Display a health report for your environment.
env See `conda env --help`.
index Update package index metadata files. Pending deprecation, use https://github.com/conda/conda-index instead.
info Display information about current conda install.
init Initialize conda for shell interaction.
inspect Tools for inspecting conda packages.
install Install a list of packages into a specified conda environment.
list List installed packages in a conda environment.
metapackage Specialty tool for generating conda metapackage.
notices Retrieve latest channel notifications.
pack See `conda pack --help`.
package Create low-level conda packages. (EXPERIMENTAL)
remove (uninstall)
Remove a list of packages from a specified conda environment.
rename Rename an existing environment.
render Expand a conda recipe into a platform-specific recipe.
repo See `conda repo --help`.
run Run an executable in a conda environment.
search Search for packages and display associated information using the MatchSpec format.
server See `conda server --help`.
skeleton Generate boilerplate conda recipes.
token See `conda token --help`.
update (upgrade) Update conda packages to the latest compatible version.
verify See `conda verify --help`.
2.1版本更新update
# 更新至最新版本,也会更新其它相关包
conda update conda
# 更新指定的包
conda update <package_name>
# 更新所有包
conda update --all
2.2显示信息info
# 查看 conda 环境详细信息
conda info
# 查看目前安装了哪些环境
conda info --envs
2.3配置config
# 改变.condarc 中的配置参数
# --set KEY VALUE Set a boolean or string key.
conda config --set auto_activate_base true # 设置打开终端时,是否自动激活 conda 的 base 环境
conda config --set auto_activate_base false
conda config --set show_channel_urls yes # 配置安装包时是否显示安装来源
# --remove KEY VALUE Remove a configuration value from a list key. This removes all instances of the value.
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ # 删除数据源
# --remove-key KEY Remove a configuration key (and all its values).
conda config --remove-key channels # 删除所有的源,即切换回默认源
# --show [SHOW ...] 显示配置的值,如果没有指定哪个KEY,就显示所有的配置值
conda config --show # 显示所有配置值的信息
conda config --show channels # 查看当前镜像源
# 添加镜像源:例如, 添加清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
2.4创建环境create
# 创建环境:-n, --name
conda create --name <env_name>
# 创建环境并指定 python 版本,env_name:环境名字;python_dis:python版本,[other packages]: 安装的其他包:-n, --name
conda create --name <env_name> python=<python_dis> <other packages>
# 复制某个环境:-n, --name
conda create --name <new_env_name> --clone <old_env_name>
# 通过导出文件安装包:-n, --name; -f, --file
conda create -n <env_name> --file requirements.txt
2.5激活与退出环境active/deactivate
# 激活一个环境
conda activate <env_name>
# 退出当前环境,返回 base 环境,如果原本就是 base 环境,则退出 conda 环境
conda deactivate
2.6安装包install
# 在当前环境中安装包
conda install <package_name>
# 指定包版本
conda install <package_name>=<version_num>
# 为指定环境安装某个包:-n, --name
conda install -n <env_name> <package_name>
# 安装本地包
conda install --use-local <package_name>
# 使用特定的软件源安装包:-c, --channel
conda install --channel <package_name> <source>
# conda 批量安装 requirements.txt 文件中包含的组件依赖,并自动将任何确认值设置为“yes”: -y, --yes; -f, --file
conda install --yes --file requirements.txt
2.7删除包或环境remove
# 删除当前环境中的某个包
conda remove <package_name>
# 删除指定环境下的一系列包:-n, --name
conda remove -n <env_name> <package_name_1> <package_name_2> ...
# 删除指定环境下的所有包以及环境自身:-n, --name
conda remove -n <env_name> --all
2.8列出包list
# 列举当前活跃环境下的所有包
conda list
# 列举指定环境中的所有包:-n, --name
conda list -n <env_name>
# 批量导出当前环境中所有包到 requirements.txt 文件: -e, --export
conda list -e > requirements.txt
# 通过导出文件安装包:-n, --name; -f, --file
conda create -n <env_name> --file requirements.txt
2.9环境env
# 查看目前安装了哪些环境
conda env list
# 导出当前环境定义文件
conda env export > environment.yml
# 根据环境定义文件创建环境,-f指定环境定义文件的路径: -f, --file
conda env create -f environment.yml
# 删除环境:-n, --name
conda env remove -n <env_name>
2.10查找包search
# 搜索源内有的指定包
conda search <package_name>
# 搜索指定包,并提供详细信息
conda search <package_name> --info
品质保证
多年的生产力软件专家
专业实力
资深技术支持项目实施团队
安全无忧
多位认证安全工程师
多元服务
软件提供方案整合,项目咨询实施
购软平台-找企业级软件,上购软平台。平台提供更齐全的软件产品、更专业的技术服务,同时提供行业资讯、软件使用教程和技巧。购软平台打造企业级数字产品综合应用服务平台。用户体验和数字类产品的专业化服务是我们不断追求的目标。购软平台您身边的企业级数字产品优秀服务商。