ubuntu 安装 cuda

Posted Michael云擎的技术博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu 安装 cuda相关的知识,希望对你有一定的参考价值。

 

方法一: Run file 安装 


wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.
2.89_440.33.01_linux.run

 

=========================

方法二:Deb 安装

Download Installer for Linux Ubuntu 18.04 x86_64

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

 

环境变量

export CUDA_HOME=/usr/local/cuda-10.2
export CUDA_ROOT=/usr/local/cuda-10.2
export PATH=$PATH:$CUDA_HOME/bin:$CUDA_HOME/include:$CUDA_HOME
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH:$CUDA_HOME/include
export CUDA_INC_DIR=$CUDA_INC_DIR:$CUDA_HOME:$CUDA_HOME/include

 

pip3 install pycuda==2019.1.2 -i https://pypi.tuna.tsinghua.edu.cn/simple      #### 不要使用sudo,否则可能会报错

 

以上是关于ubuntu 安装 cuda的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu16.04无法安装CUDA吗

Ubuntu安装cuda

ubuntu 14.04 安装cuda,开启GPU加速

ubuntu16.04 安装 CUDA

Ubuntu 11.04 安装 cuda5.0

Ubuntu安装配置Cuda和Pytorch gpu