Anaconda 环境管理

Conda是一种通用包管理系统,旨在构建和管理任何语言的任何类型的软件。
Anaconda® 是一个包管理器、一个环境管理器、一个 Python/R 数据科学发行版以及超过 7,500 个开源包的集合。
Miniconda是一个免费软件包,包含 conda 包和环境管理器,但Miniconda不包含 Anaconda、Anaconda Navigator 或安装它所需的依赖项以外的任何包。安装Miniconda后,可以使用 command 直接从命令行界面安装其他 conda 包。
Anaconda Navigator是一个桌面图形用户界面 (GUI),它允许您轻松管理conda包、环境、channels和notebooks,而无需使用命令行界面 (CLI)。
参考:https://docs.anaconda.com/anaconda/navigator/glossary/

conda的安装与使用
Anaconda介绍、安装及使用教程
官方教程

miniconda2自带python2,miniconda3自带python3,安装哪个都一样,只影响所创建环境的根目录;
另一区别在于创建新环境时的默认python版本不同。

There are two variants of the installer: Miniconda is Python 2 based and Miniconda3 is Python 3 based.
Note that the choice of which Miniconda is installed only affects the root environment.
Regardless of which version of Miniconda you install, you can still install both Python 2.x and Python 3.x environments.

The other difference is that the Python 3 version of Miniconda will default to Python 3 when creating new environments and building packages.

安装miniconda

  1. 下载miniconda安装包
    没有特定理由时,尽量选择最新版本,python版本可以后续再补充
  2. 验证安装文件完整性
    sha256sum Miniconda3-latest-Linux-x86_64.sh
    
  3. 安装,一路 Enter + yes
    bash Miniconda3-latest-Linux-x86_64.sh
    
    最后输出:
    ==> For changes to take effect, close and re-open your current shell. <==
    
    If you'd prefer that conda's base environment not be activated on startup, 
       set the auto_activate_base parameter to false: 
    
    conda config --set auto_activate_base false
    
    Thank you for installing Miniconda3!
    
  4. 验证成功安装
    conda list
    或
    conda --version
    
    新安装的conda默认环境名为base
  5. 环境激活与退出
    $ conda config --set auto_activate_base false
    
    激活名称为<env_name>的conda环境:
    conda activate <env_name>
    
    将以下内容写入.bashrc,以后使用deconda来退出conda环境:
    alias deconda='conda deactivate'
    
  6. 清华源阿里云北外
  7. 安装 Anaconda Navigator
    conda install anaconda-navigator
    

使用

1. conda版本管理

conda --version #查看版本
conda update conda #升级

2. 环境管理

  1. 新建环境
    注意,若需要使用不同于conda默认的python版本,则必须指定python版本
    conda create --name project python=3.6 
    
  2. 查看已安装的环境
    输出列表中,带星号*的是当前激活的环境
    conda info --envs 
    
  3. 搜索可从Anaconda存储库安装的包
    conda search <package-name>
    
  4. 安装包
    conda install <package-name>
    
  5. 查看已安装的包列表
    conda list
    
  6. 删除环境<env_name>
    conda remove -n <env_name> --all
    
  7. 删除一个包
    conda remove -n <env_name> <package-name>
    

问题

  • An unexpected error has occurred. Conda has prepared the above report. If submitted, this report will be used by core maintainers to improve future releases of conda. Would you like conda to send this report to the core maintainers?
    => 删除.condarc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值