nvcc --version command says nvcc is not installed
I have installed cuda8.0, the latest version. I followed the procedure provided by Nvidia; but, when I type the command nvcc --version
it says nvcc is not installed!
What do I do now?
The problem is [ based on the link you provided] you haven't added it the .bashrc
. file so it can be seen:
-
From the terminal:
nano /home/username/.bashrc # or nano /home/$USER/.bashrc
-
Inside there add the following: (replace
cuda-8.0
with your version)export PATH="/usr/local/cuda-8.0/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH"
-
Then do the following to save and close the editor:
On you keyboard press the following: ctrl + o --> save enter or return key --> accept changes ctrl + x --> close editor
-
Now either do
source .bashrc
orclose and open another terminal
-
Now run
nvcc --version
Information:
-
.bashrc
: is the file read by theterminal
before opening and its found in the/home/$USER
diretory of the user in question. - the
.
before the file means its hidden from view unless you instruct you file manager to showhidden
files
The above solution by @George Udosen is fine. If you want to save the manual procedure, you can automize it by the following:
1.create a file "add_to_bashrc"
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64
export PATH=$PATH:$CUDA_HOME/bin
2.create a shell script "automate.sh":
(... some installation procedure ...)
cat add_to_bashrc >> ~/.bashrc
. ~/.bashrc
Then you just need to run your shell script
sh automate.sh
Don't forget to check if the CUDA's shortcut (symLink) works correctly. Simply execute:
ls /usr/local/cuda
The answer from @George Udosen is perfect.
Just for increment it, you can also export to /usr/local/cuda
which is a symbolic link to /usr/local/cuda-10.1
, based on this answer. So, you can also write:
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}$
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}