fatal error: cuda_runtime_api.h: No such file or directory

在使用anaconda是遇到的问题,编译c++ cudaextension时,python setup.py install 出现fatal error: cuda_runtime_api.h: No such file or directory。

首先尝试在~/.bashrc中添加相关路径,还是不行,后面再setup.py里添加

include_dirs = [os.path.realpath('../include'), '/usr/local/cuda/include/']
  • 即在CUDAExtension里添加include_dirs,再次编译就可成功
     
    1. CUDAExtension(

    2. 'roi_align.crop_and_resize_gpu',

    3. ['roi_align/src/crop_and_resize_gpu.cpp',

    4. 'roi_align/src/cuda/crop_and_resize_kernel.cu'],

    5. include_dirs=include_dirs,

    6. extra_compile_args={'cxx': ['-g', '-fopenmp'],

    7. 'nvcc': ['-O2']}

    8. )

你可能感兴趣的:(DEEPL,python)