cc1plus: fatal error: cuda_runtime.h: No such file or directory compilation terminated.

完整问题:

cc1plus: fatal error: cuda_runtime.h: No such file or directory
compilation terminated.
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

在安装mmdetection时出现此问题,

python setup.py develop

我的环境:
pyhton:3.7.0
cuda:10.0
pytorch: 1.3.1
gcc: 5.5.0
查了很多资料,有说cuda软连接的问题,有说GCC版本问题,都尝试过,不能解决问题,一些可以参考资料如下:
mmdetection
最后随便改了下cuda的版本到9.2就不出现bug啦,可能是因为系统版本或者其他包不能支持cuda10,因为我的系统中有多个cuda,所以方便修改,直接在.bashrc文件里面修改:

export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

然后重新安装一遍pytorch和依赖包,最后没有报错。

猜你喜欢

转载自blog.csdn.net/m0_46429066/article/details/109059120