conda 常用命令

conda 常用命令

一、创建环境

python 复制代码
conda create -n test python=3.8 # test为环境名,3.5为python的版本号,-n 是name名字

二、删除环境

python 复制代码
conda remove -n test --all

三、环境重命名

python 复制代码
conda create -n NewName --clone OldName #把环境 OldName 重命名成 NewName
conda remove -n OldName --all 

四 、查看环境列表

python 复制代码
conda info -e

五、进入某个虚拟环境

python 复制代码
conda activate env_name

六、退出当前环境

python 复制代码
deactivate

七、查看当前虚拟环境下的所有安装包

python 复制代码
conda  list  需进入该虚拟环境
conda  list  -n  env_name

或者

python 复制代码
pip list

八、安装或卸载包(进入虚拟环境之后)

python 复制代码
conda  install  xxx
conda  install  xxx=版本号  # 指定版本号
conda  install  xxx -i 源名称或链接 # 指定下载源
conda  uninstall  xxx

或者

python 复制代码
pip  install  xxx
pip  install  xxx=版本号  # 指定版本号
pip  install  xxx -i 源名称或链接 # 指定下载源
pip  uninstall  xxx

九、分享虚拟环境

python 复制代码
conda env export > environment.yml  # 导出当前虚拟环境
conda env create -f environment.yml  # 创建保存的虚拟环境

十、源服务器管理

conda当前的源设置在$HOME/.condarc中,可通过文本查看器查看或者使用命令>conda config --show-sources查看。

python 复制代码
conda config --show-sources #查看当前使用源
conda config --remove channels 源名称或链接 #删除指定源
conda config --add channels 源名称或链接 #添加指定源

国内pip源

阿里云 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

豆瓣(douban) http://pypi.douban.com/simple/

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

十一、升级

升级Anaconda需先升级conda

python 复制代码
conda  update  conda
conda  update  anaconda

十二、卸载

python 复制代码
rm  -rf  anaconda

十三、卸载

python 复制代码
conda list -e > requirements.txt  # 导出
conda install --yes --file requirements.txt  # 安装

十四、pip批量导出环境中的所有组件

python 复制代码
pip freeze > requirements.txt
pip install -r requirements.txt
相关推荐
ModestCoder_2 小时前
Ubuntu 22.04,Isaac Sim 5.1.0 + Isaac Lab 2.3.0 Conda 环境安装指南
linux·ubuntu·conda
wudl55661 天前
Conda 的使用说明
conda
喜乐boy2 天前
CV系列——Conda + PyTorch + CUDA + cuDNN + Python 环境无脑安装速查笔记[2025.12]
pytorch·python·conda·cuda·cv
祁思妙想2 天前
【python】--- 创建Conda新环境/切换环境/安装
conda
Eric.Lee20212 天前
ubuntu系统在bashrc文件中对conda进行启用设置
linux·运维·python·ubuntu·conda
啦啦右一3 天前
杂货铺 | 复现Github项目,用Conda解决旧版requirements.txt的TensorFlow冲突
github·conda·tensorflow
远瞻。4 天前
【环境配置】快速转移conda上的python环境
开发语言·python·conda
毅硕科技4 天前
毅硕HPC | 在HPC集群上优雅地使用Conda
conda·hpc·应用教程·高性能计算集群·专业服务
周杰伦_Jay4 天前
【Conda 完全指南】环境管理+包管理从入门到精通(含实操示例+表格对比)
开发语言·人工智能·微服务·架构·conda
runfarther6 天前
Windows下使用源码和Conda搭建GraphRAG指南
windows·conda·graphrag