整理只为记录整个流程,缩短下次配置时间,写的较为简短。
一、anaconda安装
清华源镜像选择时间较新的Anaconda3 linux_x86_64.sh下载即可
下载后进入Download路径下
sudo sh ./Anaconda3-2021.11-Linux-x86_64.sh
赋予anaconda文件权限
sudo chmod -R 777 ./anaconda3
sudo gedit ~/.bashrc
export PATH="/home/用户名/anaconda3/bin:$PATH"
source ~/.bashrc
二、创建虚拟环境
conda create -n 环境名 python=3.x
conda activate 环境名
三、显卡驱动安装
便捷方式:附加驱动选择一个英伟达tested驱动,输入安全码,重启后进入mok,输入刚刚设置的安全码,系统启动后输入命令可查看显卡信息:
nvidia-smi
四、 tensorflow安装
3090可用版本: tensorflow2.4 + cuda11.0 + cudnn8.0 + python3.7
创建并进入虚拟环境后
pip install tensorflow==2.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda install cudnn=8.0 cudatoolkit=11.0
验证是否安装成功:
import tensorflow as tf
tf.test.is_gpu_available()
五、pytorch安装
参考版本:pytorch1.8.1+cuda11.1
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
验证是否安装成功:
import torch
torch.cuda.is_available()
六、jupyter notebook配置
pip install jupyterthemes
jt -t chesterish -f consolamono -fs 140 -altp -tfs 13 -nfs 115 -ofs 14 -cellw 80% -T
插件安装
pip install jupyter_nbextensions_configurator jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user
conda虚拟环境可切换设置:
conda install nb_conda_kernels
Original: https://blog.csdn.net/qq_34638374/article/details/122718532
Author: JanvyHung
Title: ubuntu20.04 深度学习环境搭建