conda基本操作

  • 查看版本号
    conda --version
  • 创建环境
    • 直接创建(这个会使用conda的base环境的版本进行创建)
      conda create -n new_envs
    • 指定python版本创建
      conda create -n new_envs python=3.6
  • 删除环境
    conda remove –n new_envs –-all
  • 克隆原来的环境
    conda create -n new_env2 new_envs
  • 删除旧环境
    conda remove -n new_envs -all
  • 查询现有环境
    conda env list或者conda info --envs
  • 激活环境
    conda activate 环境名称或者source active 环境名称
  • 返回默认环境
    conda deactivate或者source deactivate
  • 导出环境
    conda env export > environment.yaml
  • 用配置文件创建新的虚拟环境
    conda env create -f environment.yaml
  • 列出当前环境的所有包
    conda list
  • 安装第三方库
    conda install numpy
  • 卸载第三方库
    conda remove numpy
  • 跟新第三方库
    conda update numpy
  • 查看配置
    conda config --show
  • 删除默认的channel安装源
    conda config --remove channels defaults
  • 添加国内清华源
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容