miniconda的安装
1、下载安装包 (-c 若下载中断,可以继续上次的安装,可以省略)
注:可以去镜像网站:https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/ 找到自己想要安装的版本,我这里选择的是Miniconda3-4.7.12.1-Linux-x86_64.sh
wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-4.7.12.1-Linux-x86_64.sh
2、安装刚刚下载的miniconda3,bash就是运行.sh文件的意思
bash Miniconda3-4.7.12.1-Linux-x86_64.sh
3、类似于重启,重新加载一下配置文件.bashrc
source .bashrc
4、一些基础命令
#查看安装的conda的版本,检验是否安装成功
conda --version
#查看已安装的包
conda list
5、添加一些镜像,方便后面安装软件时,速度快一点
conda config --add channels genomedk
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/
conda config --set show_channel_urls yes
#查看已配置的镜像
conda config --show
#删除某个镜像源
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
以上步骤即为安装miniconda的基本步骤
虚拟环境的安装(以TensorFlow GPU版的安装为例)
1、创建一个新的虚拟环境。其中,python36为虚拟环境的名字,python的版本是3.6(会默认安装最新版本的python3.6版本,如:3.6.11)
conda create -n python36 python=3.6
2、激活环境后,才能进行改环境的一些具体包的安装,如:TensorFlow、pandas
conda activate python36
conda deactivate #当激活某个环境后,想停止使用该环境时,可以使用该命令
3、安装cudnn和CUDA、TensorFlow
注:这个需要根据想要安装的TensorFlow的版本,来选择安装的cuda、cudnn的版本(https://tensorflow.google.cn/install/source#gpu_support_2)
其他关于tensorflow对应cuda的兼容版本问题可参考:https://www.jianshu.com/p/1d6a508a8d04 (包括显卡驱动版本)
conda install cudatoolkit=9.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
conda install cudnn=7.1.2 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
conda install tensorflow-gpu==1.12.0
4、安装其他常用的包
#搜索是否存在某个包,以scikit-learn为例
conda search scikit-learn
#安装指定版本的包
conda install scikit-learn==0.19.1
conda install pandas==0.23.0
conda install matplotlib==2.2.2