美文网首页
conda使用笔记

conda使用笔记

作者: 胡童远 | 来源:发表于2021-04-16 14:22 被阅读0次

conda参数

conda --help
positional arguments:
    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/cheng/.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.
    update       Updates conda packages to the latest compatible version.
    upgrade      Alias for conda update.

基本使用

conda create -n kraken2  # 创建环境
conda create -n kraken2 python=3.8  # 创建环境,并安装py3.8
conda create -n python3.7 python=3.7 -c bioconda
conda info --envs  # 查看环境列表
conda activate ENV  # 激活conda环境
conda deactivate ENV  # 退出conda环境
conda list  # 查看conda中已经安装的软件
conda remove -n ENV --all  # 删除conda环境

# 运行配置文件
source /hwfssz1/ST_META/PN/hutongyuan/software/miniconda3/etc/profile.d/conda.sh

conda安装和更新软件

conda install diamond  # conda安装软件,默认最新版
conda install diamond=0.8.22  # conda安装指定版本的软件
conda install python=3.8  # 安装python
conda install salmon -n base # 指定环境安装

# 安装R包
conda install r-base=4.0.3  # 安装R
conda install r-vegan   # 安装R包
conda install r-vegan r-ggplot2 r-ape

# 安装python module
conda install py-bio  # conda安装python模块
conda install pandas=1.2.3
pip3 install biopython  # bio
conda install scikit-learn # 同时安装了,scipy
conda install matplotlib

pip安装和更新python模块

export PYTHONPATH=$PYTHONPATH:/path/to/module  # 添加路径到python环境

python3 -m pip install bio  # 指定python安装模块
python3 -H -m pip install --upgrade jinja2  # 更新模块,将 HOME 变量设为目标用户的主目录
python3.6 -m pip install Biopython --no-cache-dir  # Disable cache
pip install --user --upgrade numpy==1.19.5

git clone install

pip install git+https://github.com/qiyunlab/HGTector.git
# 等价于下方,但是上方报错了
git clone https://github.com/qiyunlab/HGTector.git
cd HGTector
python setup.py install 
# --user  # 该参数会把软件安装在Home,家小勿用

pip install git(pip直接安装git上的项目)

查看,添加镜像

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
conda config --add channels biobakery
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
conda config --show  # 查看新增channels

我的conda环境

# miniconda
source /hwfssz1-tmp/ST_META/hutongyuan/software/miniconda3/etc/profile.d/conda.sh
# miniconda
source /hwfssz5/ST_META/P18Z10200N0423_ZYQ/MiceGutProject/hutongyuan/software/miniconda3/etc/profile.d/conda.sh
conda activate base
1 kneaddata
conda activate r411
1 R4.1.1
conda activate snp
1 samtools
2 bcftools

查看版本

# pip
pip list
# python
import pandas as pd
pd.show_versions()
pd.__version__
pd.version
np.version

Tips
1 按项目建环境,新建环境安装软件超级快

相关文章

网友评论

      本文标题:conda使用笔记

      本文链接:https://www.haomeiwen.com/subject/qkdelltx.html