若您想要使用 nvcc,可是所選的鏡像中沒有預裝 nvcc,可按照以下操做自行安裝。ubuntu
一、檢查系統版本bash
source /etc/os-release && echo $VERSION_ID
二、導入apt倉庫和其GPG keycurl
# 第一步若輸出 16.04 curl -fsSL https://mirrors.aliyun.com/nvidia-cuda/ubuntu1604/x86_64/7fa2af80.pub | apt-key add - echo "deb https://mirrors.aliyun.com/nvidia-cuda/ubuntu1604/x86_64/ /" > /etc/apt/sources.list.d/cuda.list # 第一步若輸出 18.04 curl -fsSL https://mirrors.aliyun.com/nvidia-cuda/ubuntu1804/x86_64/7fa2af80.pub | apt-key add - echo "deb https://mirrors.aliyun.com/nvidia-cuda/ubuntu1804/x86_64/ /" > /etc/apt/sources.list.d/cuda.list
三、安裝所需版本的 nvccurl
apt update # "10-0" 表示安裝CUDA10.0版本的 nvcc, 應根據鏡像中cuda版本安裝 apt install cuda-command-line-tools-10-0
cuda10的鏡像ubuntu1804code
apt update apt install cuda-command-line-tools-10-0
cuda10.1的鏡像ubuntu1804get
apt update apt install cuda-command-line-tools-10-1
cuda10.2的鏡像ubuntu1804io
apt update apt install cuda-command-line-tools-10-2
cuda9的鏡像ubuntu1604class
apt update apt install cuda-command-line-tools-9-0
cuda8的鏡像ubuntu1604date
apt update apt install cuda-command-line-tools-8-0
四、驗證nvcc安裝command
nvcc --version
參考連接