A special mentality point of ubuntu: /usr/bin/nvcc: 3: exec: /usr/lib/nvidia-cuda-toolkit/bin/nvcc: not found

The thing is like this, I downloaded cuda and cuda-10.2, and cuda and cuda-10.2 are in the usr/local/ path, but I got this error /usr/bin/nvcc: 3: exec: /usr/lib /nvidia-cuda-toolkit/bin/nvcc: not found
Why is this error reported? Isn't it the error -bash: nvcc: command not found?

I gave a lot of advice online.

For example, I deleted the original cuda and reinstalled it. However, after I tried reinstalling n times, I found that the problem still existed. Moreover, my environment variables have also been added, like this:

export PATH=/usr/local/cuda-10.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH

This is no problem. You need to add it and use it later.source ~/.bashrc激活,但是依旧还是同样的错误,之后我就进入/usr/bin目录中,ls了一下,发现这里面也有一个nvcc(这可能是因为我之前用sudo apt install 下载了cuda toolkit,但是我删除这个cuda的时候是直接用的rm)

可以通过这个查看nvcc在哪里。

which nvcc

Afterwards, I deleted nvcc in the /usr/bin directory and solved the problem.

cd /usr/bin
rm -rf nvcc

have a test:

nvcc --version

Guess you like

Origin blog.csdn.net/qq_60943902/article/details/132346493