下载地址
miniconda镜像地址:https://mirrors.bfsu.edu.cn/anaconda/miniconda/
安装,不用版本自带py版本不同,集群需要在登录节点操作,有网
wget --no-check-certificate https://mirrors.bfsu.edu.cn/anaconda/miniconda/Miniconda3-py38_23.1.0-1-Linux-x86_64.sh
chmod 777 Miniconda3-py38_23.1.0-1-Linux-x86_64.sh #刚下载好的安装包没有可执行权限,所以需要先给权限
sh Miniconda3-py38_23.1.0-1-Linux-x86_64.sh #登录节点有网 运行.sh
yes #选择yes
[/home/pengzw/miniconda3] >>> /share/nas1/pengzw/software/miniconda3 #指定安装路径,否则默认到家目录
PREFIX=/share/nas1/pengzw/software/miniconda3
Miniconda3的默认安装路径是“/home/<username>/miniconda3”。这里的<username>表示用户名,不同的Linux用户名,安装路径稍有不同,我本想安装到我目录software目录下,结果没注意到这点,还是安到了我的用户名下。可以在bash的路径下选择miniconda3,就会安装在software/miniconda3目录下
初始化conda
在安装尾声,程序会询问是否通过conda来初始化miniconda3”,实际上就是将Anaconda的环境变量导入到PATH中,输入“yes”。这样一来,以后就可以直接在终端使用诸如ipython、spyder等命令了(这些好用的命令,均来自conda环境)。
最后,当屏幕输出“Thank you for installing Miniconda3!”字样时,就表明Miniconda3安装完毕了。
注:此时还不能调用conda命令,如输入conda --version时提示没有找到。是因为安装好conda之后需要重新激活一下source .bashrc,有点类似重启的意思。之后输入conda --version 就可以查看conda的版本了,输con然后按Tab键也能自动补全了:
添加镜像,命令行执行
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/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes
不让登录shell就进入base环境,直接命令行输入或者编辑~/.condarc
conda config --set auto_activate_base false #设置false
cat .condarc
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
show_channel_urls: true
auto_activate_base: false
1.1初始化环境,加入环境变量
conda init #
conda info #查看环境
conda info -e #查看已创建的所有[虚拟环境]
1.1 进入base 环境,最好不要在base环境安装软件
conda activate +环境名称
conda deactivate
1.2 安装软件,需要退出base环境(建议每个软件创建一个env)
conda create -n quast python=3.7 #创建一个名为py37的环境,指定Python版本是3.7(不用管是3.7.x,conda会为我们自动寻找3.7.x中的最新版本)
conda activate quast #需要网络
1.3 安装具体软件:环境中安装模块的时候必须先激活该环境,然后在该环境中进行安装
conda activate quast
conda install quast
conda deactivate
/share/nas1/pengzw/software/miniconda3/bin/conda init quast #如果conda失效,可以尝试
查看特定包和安装
conda search fastqc #默认应该是装最新的版本,可以查看历史版本。
#### 安装特定版本的软件包(查看软件版本可以使用conda search fastqc)
conda install fastqc=0.11.6 #直接默认到base环境,不建议
安装和删除py或者perl模块
conda install requests #py
conda uninstall requests
conda install perl-JSON #perl ,模块名字大小写有的都可以,有的可能涉及子模块,可以去查找具体的模块名字https://metacpan.org/
/share/nas2/genome/biosoft/miniconda3/envs/py3.7.3/bin/pip install progressbar2=3.51.4 #有些conda没有的模块则用pip安装
使用的时候环境变量加上conda路径。不用就注释掉,初始化要重新登录一个窗口,source不能及时生效,进入env
conda create -n wgdi #登录节点有网 ,会在/share/nas1/pengzw/software/miniconda3/envs/wgdi/创建一个文件夹
conda create -c bioconda -n wgdi wgdi python=3.8.5
conda create -c bioconda -n tidk tidk
1.4 删除软件,删除环境
1.首先,在家目录~或者安装软木有一个miniconda3的文件夹,使用rm命令将它删除:
2.然后,用vim命令进入.bashrc文件,将conda的语句用#注释掉:
3.最后,重新激活一下source .bashrc就可以了。
删除环境
conda remove env_name --all
1.5 conda安装报错1:An unexpected error has occurred. Conda has prepared the above report.
查看是否存在.condarc文件,存在则移走或者删掉即可以
conda config --show-sources
1.6 如何调用软件?
激活环境
conda activate quast
quast
不激活环境
#当前脚本中写入
export PATH=/share/nas1/pengzw/software/miniconda3/bin/:$PATH
#直接绝对路径调用软件
/share/nas1/pengzw/software/miniconda3/bin/quast
1.7 查看某个软件依赖的环境模块版本等
conda search wgd --info
conda list biopython #查看已安装的软件版本
####### pip查看模块可用版本
python -m site #查看pip安装的位置,调用env里面的pip就是env位置
/share/nas2/genome/biosoft/miniconda3/envs/wgd/bin/pip index versions pyqtwebengine
参考其他的常见用法:
https://blog.csdn.net/miracleoa/article/details/106115730