下载conda
https://www.anaconda.com/distribution/
安装
bash ./Anaconda3-2019.03-Linux-x86_64.sh
添加源
速度快, https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
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 --set show_channel_urls yes
pip也可以添加清华的源:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
参考:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
配置环境变量
创建新的环境:
conda create -n pytorch
source activate pytorch
安装环境
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
命令参考: https://pytorch.org/
查看 CUDA 版本: cat /usr/local/cuda/version.txt
查看 CUDNN 版本:cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
conda install jupyter notebook
在环境里安装:conda install ipykernel
python -m ipykernel install --user --name pytorch --display-name "python"
生成配置文件
jupyter notebook --generate-config
修改配置文件
c.NotebookApp.allow_remote_access = True
c.NotebookApp.ip = ‘*’
c.NotebookApp.notebook_dir = ‘/path/’
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9999
启动服务
nohup jupyter notebook --config=jupyter_notebook_config.py > log.out 2>&1 &
扩展插件
pip install jupyter-contrib-nbextensions
jupyter contrib nbextension install --user
jupyter的使用:https://www.jianshu.com/p/91365f343585
设置同一个单元格打印多个变量:https://www.cnblogs.com/everfight/p/juypter-notebook.html
扩展插件的介绍:https://blog.youkuaiyun.com/u013555719/article/details/77446545
安装
conda install scikit-learn
pip install -U matplotlib
pip install easydict
移植
https://blog.youkuaiyun.com/sinat_28442665/article/details/86650152
#通用格式
conda env export -n 项目名 -f environment.yaml
#在env外导出
conda env export -n snakemake-tutorial > snakemake.yml
#在snakemake-tutorial 环境内导出
conda env export > snakemake.yaml
pip freeze > requirements.txt
#查看snakemake.yaml文件
cat snakemake.yaml
name: snakemake
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- asn1crypto=0.24.0=py35_3
- bcftools=1.3.1=h84994c4_5
- bcrypt=3.1.4=py35h14c3975_0
- bwa=0.7.12=1
#根据文件创建环境变量的通用格式
conda env create --name snakemake --file snakemake.yaml
#创建snakmake环境
conda env create -f snakemake.yaml
pip install -r requirements.txt