首页 > 编程知识 正文

linux如何使用anaconda,linux 怎么查看anaconda环境配置

时间:2023-05-05 23:07:58 阅读:284087 作者:4155

本文参考Anaconda查看、删除、增加channel 、Anaconda查找源及配置清华镜像几篇文章,学习对Anaconda中Channel的设置等方法。
之前在安装软件时看到大家都在说尽量使用Anaconda来安装,这样可以连同软件依赖的包一起安装,我自己才装了SRA Toolkits和Anaconda两个软件,都是从Firefox网站下载后使用bash命令安装,另一个FastQC是Ubuntu系统自带的,使用apt-get install fastqc 命令就装上了,因此还不懂大家说的依赖包,今天在学RNA-seq时需要使用其他软件,因此先回过头来看看Anaconda怎么使用。
补充参考文章:
conda的安装与使用(2019-6-28更新)
RNA-seq(1) :用conda安装RNA-seq所需要的工具
RNA-seq基础入门传送门
清华镜像源官网:Anaconda 镜像使用帮助
软件介绍
Conda is a tool for managing and deploying applications, environments and packages.
命令用法

usage: conda [-h] [-V] command ...详见: conda --help

查看自己Anaconda的设置

(base) zexing@DNA:~$ conda info active environment : base active env location : /f/xudonglab/zexing/miniconda3 shell level : 1 user config file : /f/xudonglab/zexing/.condarc populated config files : conda version : 4.8.2 conda-build version : not installed python version : 3.7.6.final.0 virtual packages : __glibc=2.23 base environment : /f/xudonglab/zexing/miniconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /f/xudonglab/zexing/miniconda3/pkgs /f/xudonglab/zexing/.conda/pkgs envs directories : /f/xudonglab/zexing/miniconda3/envs /f/xudonglab/zexing/.conda/envs platform : linux-64 user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Linux/4.4.0-161-generic ubuntu/16.04.6 glibc/2.23 UID:GID : 1035:1037 netrc file : None offline mode : False

根据以上显示,自己认为default _channels如下:
https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
看网上说这些网站是国外的,下载速度会受影响,而且有些软件可能没有?这个还没体验过。
看别人说国内的镜像源下载会快,学着设置了一下清华镜像,操作如下:

(base) zexing@DNA:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/(base) zexing@DNA:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/(base) zexing@DNA:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/(base) zexing@DNA:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/(base) zexing@DNA:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/(base) zexing@DNA:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/#根据官网提供的还有其他几个目录,但是channel貌似有数量限制,后边的没办法加入。

按照上面执行完之后,试着搜了一个软件,显示一堆相关信息,应该是提供了很多下载源吧,只是试试就没有后续安装。

anaconda search -t conda tensorflow#内容太多,省略。。。。。

重新查看Anaconda设置:

(base) zexing@DNA:~$ conda info active environment : base active env location : /f/xudonglab/zexing/miniconda3 shell level : 1 user config file : /f/xudonglab/zexing/.condarc populated config files : /f/xudonglab/zexing/.condarc conda version : 4.8.2 conda-build version : not installed python version : 3.7.6.final.0 virtual packages : __glibc=2.23 base environment : /f/xudonglab/zexing/miniconda3 (writable) channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkg168飞艇6种不亏钱的方法 python version : 3.7.6.final.0 virtual packages : __glibc=2.23 base environment : /f/xudonglab/zexing/miniconda3 (writable) channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /f/xudonglab/zexing/miniconda3/pkgs /f/xudonglab/zexing/.conda/pkgs envs directories : /f/xudonglab/zexing/miniconda3/envs /f/xudonglab/zexing/.conda/envs platform : linux-64 user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Linux/4.4.0-161-generic ubuntu/16.04.6 glibc/2.23 UID:GID : 1035:1037 netrc file : None offline mode : False

显示的Channel已经增加了,应该是成功了。
另一篇文章提供查看channel的方法:前往当前用户的家目录下,查看.condarc文件。

show_channel_urls: truechannels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - defaults

注意:配置完成之后,要关闭控制台再重新打开控制台,这样新配置的文件才会被加载进来。
使用conda config --get channels命令查看

xiaomotong@VirtualBox:~/桌面$ conda config --get channels--add channels 'defaults' # lowest priority--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/' # highest priority

删除某个镜像源

conda config –remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free#没有操作,记录备用。

恢复默认镜像

conda config --remove-key channels # 恢复默认下载源,即Anaconda原来默认的网址

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。