一、显卡驱动安装
执行nvidia-smi查看安装情况
二、cuda安装
cuda官网下载cuda_11.6.2_510.47.03_linux.run,安装执行
sudo sh cuda_11.6.2_510.47.03_linux.run
提升安装项,驱动不用安装,即第一项(Driver),按空格键取消,接下选在Install进行安装
修改环境变量
sudo gedit ~/.bashrc
在最后添加
# Add the related bin and lib for cuda toolkit
export PATH="/usr/local/cuda-11.6/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.6/lib64:$LD_LIBRARY_PATH"
更新环境
source ~/.bashrc
三、安装cudnn
cudnn官网下载cudnn-local-repo-ubuntu1804-8.9.5.30_1.0-1_amd64.deb,安装
sudo dpkg -i cudnn-local-repo-ubuntu1804-8.9.5.30_1.0-1_amd64.deb
查看安装情况
nvcc -V
四、anconda安装
下载Anaconda3-2021.04-Linux-x86_64.sh进行安装
sudo sh Anaconda3-2021.04-Linux-x86_64.sh
如果想关闭默认环境,执行
If you'd prefer that conda's base environment not be activated on startup, set the auto_activate_base parameter to false: conda config --set auto_activate_base false
五、pytorch-gpu安装
安装链接,执行
pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116
六、pycharm安装
下载并安装
添加快捷方式
sudo gedit /usr/share/applications/pycharm.desktop
[Desktop Entry]
Version=1.0
Name=Pycharm Community Edition
Comment=Python IDE for Professional Developers
Exec=/xxx/pycharm/bin/pycharm.sh
Icon=/xxx/pycharm/bin/pycharm.png
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-pycharm-ce
Type=Application
Categories=Development;IDE;Python;
执行
sh /xxx/pycharm/bin/pycharm.sh
运行pycharm应用
环境添加选在python3.xx