我知道我的 kernel.h 文件位于/usr/include/linux/中 但这个 Nvidia 程序找不到它 然后它要求我使用 --kernel-source-path 参数运行它 我确实给了它这条路,但它不起作用 它说找不到它,因为它不会走正确的路径 只需通过
即可运行 ./nvidia.run
返回:
ERROR: Unable to find the kernel source tree for the currently running<br/>
kernel. Please make sure you have installed the kernel source files<br/>
for your kernel and that they are properly configured; on Red Hat<br/>
Linux systems, for example, be sure you have the 'kernel-source' or<br/>
'kernel-devel' RPM installed. If you know the correct kernel source<br/>
files are installed, you may specify the kernel source path with the<br/>
'--kernel-source-path' command line option.
然后通过
运行它 ./nvidia.run --kernel-source-path /usr/include/linux/
返回:
ERROR: The kernel header file '/usr/include/linux//include/linux/kernel.h'<br/>
does not exist. The most likely reason for this is that the kernel<br/>
source path '/usr/include/linux/' is incorrect. Please make sure you
have installed the kernel source files for your kernel and that they<br/>
are properly configured; on Red Hat Linux systems, for example, be<br/>
sure you have the 'kernel-source' or 'kernel-devel' RPM installed.<br/>
If you know the correct kernel source files are installed, you may<br/>
specify the kernel source path with the '--kernel-source-path'<br/>
command line option.
我的第一个想法是从地址中删除/include/linux/ 但告诉它去路径/usr/只是告诉我它是无效的。 kernel.h 文件确实位于/usr/include/linux/kernel.h 中 但我无法让它阅读。
ERROR: The kernel source path '/usr/' is invalid. Please make sure you have
installed the kernel source files for your kernel and that they are<br/>
properly configured; on Red Hat Linux systems, for example, be sure<br/>
you have the 'kernel-source' or 'kernel-devel' RPM installed. If you
know the correct kernel source files are installed, you may specify<br/>
the kernel source path with the '--kernel-source-path' command line<br/>
option.
最佳答案
根据https://ubuntuforums.org/showthread.php?t=843914 ,你可以试试
sudo apt update
sudo apt install linux-headers-`uname -r`
关于linux-kernel - 适用于 Linux 的 Nvidia 驱动程序找不到 kernel.h 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51883133/