nvcc not installed
问题
运行github上一个项目,提示需要安装nvcc,该项目提供了以下代码用于测试nvcc的安装情况
nvcc test_nvcc.cu -o test_nvcc -run
测试输出如下,提示没有安装
The program ‘nvcc’ is currently not installed. To run ‘nvcc’ please ask your administrator to install the package ‘nvidia-cuda-toolkit’
解决方法
首先确认/usr/local/cuda/bin
文件夹下存在nvcc
文件,判断是环境变量存在问题
编辑~/.bashrc
文件
添加下面两行,配置环境变量
export LD_LIBRARY_PATH=/usr/local/cuda/lib
export PATH=$PATH:/usr/local/cuda/bin
再执行source ~/.bashrc
更新配置
重新执行项目提供的测试命令:
nvcc test_nvcc.cu -o test_nvcc -run
成功输出:
| CPU says hello.
| GPU says hello.