conda在linux上的使用

conda简介

Conda 是一个开源的软件包管理系统和环境管理系统,用于安装多个版本的软件包及其依赖关系,并在它们之间轻松切换。 Conda 是为 Python 程序创建的,适用于 Linux,OS X 和Windows,也可以打包和分发其他软件。

Conda作为软件包管理器可以帮助您查找和安装软件包。如果您需要一个需要使用其他版本的Python的软件包,则无需切换到其他环境管理器,因为conda也是环境管理器。仅需几个命令,您就可以设置一个完全独立的环境来运行该不同版本的Python,同时继续在正常环境中运行您通常的Python版本。(来自官网)

安装conda

  • 自用的是ubuntu所以只介绍linux下的安装
1、从官网上下载对应系统的安装包文件,linux是.sh文件
2、输入 bash xxx.sh 文件 //这里可能需要权限。
3、最后输入 conda init fish 完成安装

安装时一路选择yes即完成了环境变量的配置。

conda使用

  • 直接在命令行使用
#直接输入conda得到以下一些可选的操作方式:
usage: conda [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command
    clean        Remove unused packages and caches.
    config       Modify configuration values in .condarc. This is modeled
                 after the git config command. Writes to the user .condarc
                 file (/home/huang/.condarc) by default.
    create       Create a new conda environment from a list of specified
                 packages.
    help         Displays a list of available conda commands and their help
                 strings.
    info         Display information about current conda install.
    init         Initialize conda for shell interaction. [Experimental]
    install      Installs a list of packages into a specified conda
                 environment.
    list         List linked packages in a conda environment.
    package      Low-level conda package utility. (EXPERIMENTAL)
    remove       Remove a list of packages from a specified conda environment.
    uninstall    Alias for conda remove.
    run          Run an executable in a conda environment. [Experimental]
    search       Search for packages and display associated information. The
                 input is a MatchSpec, a query language for conda packages.
                 See examples below.
    update       Updates conda packages to the latest compatible version.
    upgrade      Alias for conda update.

optional arguments:
  -h, --help     Show this help message and exit.
  -V, --version  Show the conda version number and exit.

conda commands available from other packages:
  build
  convert
  debug
  develop
  env
  index
  inspect
  metapackage
  render
  server
  skeleton
  verify

  • 查看当前使用的环境:

conda info

任务Conda软件包和环境管理器命令点软件包管理器命令Virtualenv Environment Manager命令
安装套件conda install $PACKAGE_NAMEpip install $PACKAGE_NAMEX
更新包conda update --name $ENVIRONMENT_NAME $PACKAGE_NAMEpip install --upgrade $PACKAGE_NAMEX
更新程序包管理器conda update condaLinux / macOS:Win:pip install -U pip``python -m pip install -U pipX
卸载软件包conda remove --name $ENVIRONMENT_NAME $PACKAGE_NAMEpip uninstall $PACKAGE_NAMEX
创建环境conda create --name $ENVIRONMENT_NAME pythonXcd $ENV_BASE_DIR; virtualenv $ENVIRONMENT_NAME
激活环境conda activate $ENVIRONMENT_NAME*Xsource $ENV_BASE_DIR/$ENVIRONMENT_NAME/bin/activate
停用环境conda deactivateXdeactivate
搜索可用的软件包conda search $SEARCH_TERMpip search $SEARCH_TERMX
从特定来源安装软件包conda install --channel $URL $PACKAGE_NAMEpip install --index-url $URL $PACKAGE_NAMEX
列出已安装的软件包conda list --name $ENVIRONMENT_NAMEpip listX
创建需求文件conda list --exportpip freezeX
列出所有环境conda info --envsX安装virtualenv包装器,然后 lsvirtualenv
安装其他软件包管理器conda install pippip install condaX
安装Pythonconda install python=x.xXX
更新Pythonconda update python*XX

添加频道

conda config --add channels bioconda
conda config --add channels conda-forge
//清华的镜像
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/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坠入my

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值