anaconda3安装
参考链接:
https://blog.csdn.net/qq_15192373/article/details/81091098
对应命令:
bash Anaconda3-5.2.0-Linux-x86_64.sh
cuda10.1安装
安装cuda前的准备参考链接:
https://www.e-learn.cn/topic/3766913
对应到命令:
uname -m && cat /etc/*release
uname -r
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get remove --purge nvidia*
sudo apt-get update
sudo apt-get install dkms build-essential linux-headers-generic
安装驱动和cuda10.1+cudnn参考链接:
https://blog.csdn.net/sun_5flower/article/details/109777072
对应命令:
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
nvidia-smi
gcc --version
g++ --version
sudo sh cuda_10.1.168_418.67_linux.run
cd ~
sudo gedit .bashrc
然后在文件末尾添加:
# add cuda path # 在文件末尾添加路径
export PATH="/usr/local/cuda-10.1/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH"
保存然后在终端输入:
sudo gedit /etc/profile
在文件末尾添加:
# add cuda path # 文件末尾增加以下两行代码
export PATH="/usr/local/cuda-10.1/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH"
保存在终端输入使其生效:
source .bashrc
验证是否安装成功:
nvcc -V
cudnn对应命令:
sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb
cp -r /usr/src/cudnn_samples_v7 /$HOME
cd $HOME/cudnn_samples_v7/mnistCUDNN/
sudo make clean
sudo make
sudo ./mnistCUDNN
安装pytorch
添加镜像:
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
创建虚拟环境:
conda create --name python38 python=3.8 anaconda
激活虚拟环境:
source activate python38
添加镜像:
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
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
选择安转的版本:
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1
写一个简单的代码验证是否安装成功:
import torch
print(torch.__version__)
print('gpu:',torch.cuda.is_available())
pip安装cv2库
pip install opencv-python=4.1.2
安装tensorboard:
conda install tensorboard==2.2
安装tensorflow1.4+keras
对应命令:
conda create --name tf14 python=3.6 anaconda
pip install --ignore-installed --upgrade tensorflow-gpu==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
由于镜像会出问题:
conda config --remove-key channels
conda config --append channels conda-forge --append channels bioconda --append channels defaults
添加镜像:
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
安装keras:
pip install keras==2.1.3
安装pycharm
参考链接:
https://blog.csdn.net/feimeng116/article/details/105837483
对应命令:
tar -zxvf pycharm-community-2020.1.5.tar.gz
sudo mkdir /opt/pycharm
sudo mv pycharm-2020.1/ /opt/pycharm/
cd /opt/pycharm/
ls
sh /opt/pycharm/pycharm-2020.1/bin/pycharm.sh