Ubantu18.04安装CUDA10.0过程,sh: 0: Can‘t open cuda_10.0.130_410.48_linux.run错误

安装CUDA10.0

若出现问题了,可以查看坑1和问题2.之后安装CUDA成功后,继续进行配置。

现在CUDA更新到11了,如果需要安装CUDA10.0,可以点击这里
Ubantu18.04安装CUDA10.0过程,sh: 0: Can‘t open cuda_10.0.130_410.48_linux.run错误_第1张图片
这是安装提示:
Ubantu18.04安装CUDA10.0过程,sh: 0: Can‘t open cuda_10.0.130_410.48_linux.run错误_第2张图片
下载:
① 通过浏览器下载后的文件,按照教程来使用sudo sh ./cuda_10.0.130_410.48_linux.run即可正确安装。
② 我在shell环境下使用wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux下载的,速度可达8M/s的速度。【更新:发现问题了,使用此代码会出现坑1问题,安装时执行sudo sh ./cuda_10.0.130_410.48_linux即可解决。】

配置

坑1:sh: 0: Can't open cuda_10.0.130_410.48_linux.run

执行sudo sh ./cuda_10.0.130_410.48_linux.run会报错:sh: 0: Can't open cuda_10.0.130_410.48_linux.run。以下是两种问题及解决办法:
① 不能识别中文文件夹
那么进入到下载文件的文件夹,右键,open in terminal 再执行
② 文件名错误
应该根据你下载下来的文件名执行。我的解决办法:去掉.run,执行sudo sh ./cuda_10.0.130_410.48_linux,即可正确运行。

后面就是根据安装时的命令提示进行安装了,最后我出现了这个问题:
Ubantu18.04安装CUDA10.0过程,sh: 0: Can‘t open cuda_10.0.130_410.48_linux.run错误_第3张图片

看代码正确执行与否:可使用echo $?,若返回0,则代表所有代码正确执行;返回数字则代表错误代码数。

从上面的安装后的英文提示看,我发现自己并没有正确安装,并且执行echo $?返回127,再到相应文件夹发现没有安装文件。由此肯定出错了。

关于错误The driver installation is unable to locate the kernel source

Installing the NVIDIA display driver...
The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are installed and set up correctly.
If you know that the kernel source packages are installed and set up correctly, you may pass the location of the kernel source with the '--kernel-source-path' flag.

===========
= Summary =
===========

Driver:   Installation Failed
Toolkit:  Installation skipped
Samples:  Installation skipped

解决办法,install dkms:
sudo apt install dkms
再执行CUDA10.0安装命令:sudo sh ./cuda_10.0.130_410.48_linux或者sudo sh ./cuda_10.0.130_410.48_linux.run

安装成功截图:
Ubantu18.04安装CUDA10.0过程,sh: 0: Can‘t open cuda_10.0.130_410.48_linux.run错误_第4张图片

执行./deviceQuery ,报错``

错误详情:

(base) muzi@ubuntu:~//usr/local/cuda/samples/1_Utilities/deviceQuery $./deviceQuery
./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 38
-> no CUDA-capable device is detected

解决办法:

检查NVIDIA驱动是否安装好了

nvidia-smi

返回出这个信息

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

则显示NVIDIA驱动安装错误,需要安装驱动,参考此文章:Ubuntu 18.04 安装NVIDIA显卡驱动教程

参考资料:
https://askubuntu.com/questions/985497/sudo-sh-cuda-9-0-176-384-81-linux-run (关于坑1)
https://blog.csdn.net/baobei0112/article/details/81488478(关于错误2)
https://blog.csdn.net/qq_32408773/article/details/84112166(安装CUDA)

你可能感兴趣的:(错误记录)