参考内容
http://blog.csdn.net/u012759136/article/details/53355781
http://blog.csdn.net/zafir_410/article/details/73188228
https://devtalk.nvidia.com/default/topic/996474/linux/unable-to-load-the-nvidia-drm-kernel-module-fedora-25-kernel-4-9-11/
https://devtalk.nvidia.com/default/topic/926967/unable-to-load-kernel-module-for-364-12/
去官网 驱动程序 | GeForce 下载对应驱动。我下载时最新的是 384.90 版本,下载后文件为 NVIDIA-Linux-x86_64-384.90.run
。
sudo apt-get remove –purge nvidia*
1. 添加黑名单
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
输入以下内容并保存
blacklist nouveau
options nouveau modeset=0
2. 执行
sudo update-initramfs -u
3. 重启电脑后检查
lsmod | grep nouveau
若无输出则可以
1. 进入本地控制台
Ctrl + Alt + F1
2. 关闭图形界面
sudo service lightdm stop
3. runfile 安装
sudo chmod a+x NVIDIA-Linux-x86_64-384.90.run
sudo ./NVIDIA-Linux-x86_64-384.90.run –no-x-check –no-nouveau-check –no-opengl-files
参数含义
按安装提示一步一步就可以,基本上都选 Accept
。
5. 启动图形界面
sudo service lightdm start
这时候可以进终端检查是否有 nvidia-smi
,执行后应该会显示类似这样的结果,说明安装成功。
1. ERROR: Unable to load the ‘nvidia-drm’ kernel module.
检查 BIOS 的 Secure Boot 是否关闭,如果没有关闭,把他关掉即可,
官网下载 CUDA Toolkit Archive,选择 CUDA Toolkit 8.0 GA1 (Sept 2016)
,下载 runfile 文件 cuda_8.0.44_linux.run
。
sudo chmod a+x cuda_8.0.44_linux.run
sudo ./cuda_8.0.44_linux.run
依次按如下选择
Description
This package includes over 100+ CUDA examples that demonstrate
various CUDA programming principles, and efficient CUDA
implementation of algorithms in specific application domains.
The NVIDIA CUDA Samples License Agreement is available in
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48?
(y)es/(n)o/(q)uit: n
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /home/c302 ]:
Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
Installing the CUDA Samples in /home/c302 ...
Copying samples to /home/c302/NVIDIA_CUDA-8.0_Samples now...
Finished copying samples.
打开 ~/.bashrc
添加
export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
官网下载 NVIDIA cuDNN,要注册账号还有填一个很简单的问卷。
解压并放到相应位置
tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
这个就很简单了,按照官网教程用 `pip` 安装,选择 GPU 版本。
# Ubuntu/Linux 64-bit, CPU only, Python 2.7
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc1-cp27-none-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc1-cp27-none-linux_x86_64.whl
# Mac OS X, CPU only, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0rc1-py2-none-any.whl
# Mac OS X, GPU enabled, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.0rc1-py2-none-any.whl
# Ubuntu/Linux 64-bit, CPU only, Python 3.4
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc1-cp34-cp34m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc1-cp34-cp34m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, CPU only, Python 3.5
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc1-cp35-cp35m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc1-cp35-cp35m-linux_x86_64.whl
# Mac OS X, CPU only, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0rc1-py3-none-any.whl
# Mac OS X, GPU enabled, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.0rc1-py3-none-any.whl
安装
# Python 2
$ sudo pip install --upgrade $TF_BINARY_URL
# Python 3
$ sudo pip3 install --upgrade $TF_BINARY_URL
至此,就全部安装好了,进入 python
导入包后应该会显示