step1:搜索cuda官网,选择CUDA Toolkit | NVIDIA Developer,点击进入,进入后点击下载,选择适合自己的版本,点击下载
step2:安装cuda
添加环境变量 sudo vim ~/.bashrc
配置环境变量
在行末添加下面的代码:
export PATH=/media/lee/ubuntu/cuda10.0/bin:$PATH
export LD_LIBRARY_PATH=/media/lee/ubuntu/cuda10.0/lib64:$LD_LIBRARY_PATH
立即使配置的环境变量生效
source ~/.bashrc
为了防止出现空间不足的问题,我先运行了下面的命令:
sudo mkdir /tmp
sudo ./cuda_10.0.130_410.48_linux.run --tmpdir=/media/lee/ubuntu/cuda10.0/tmp/
安装成功以后输入: nvcc --version 会显示如下的命令行
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130
转载自:https://xmq1221.github.io/2018/05/21/Ubuntu%E5%AE%89%E8%A3%85CUDA%E3%80%81CUDNN/
https://blog.csdn.net/u010094199/article/details/54380086