CUDA 11.8 doesn't after export PATH and LD_LIBRARY_PATH export

Hi everyone,

I installed the CUDA 11.8.

Then, as the GUIDE says, I exported the PATH and LD_LIBRARY_PATH .

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

When I run nvcc --version on the terminal, where I did the export, it works:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

but when I run it in other terminal I get this:

Command 'nvcc' not found, but can be installed with:
sudo apt install nvidia-cuda-toolkit

How to solve it?

if you do a google search on how to make linux environment variables “permanent”, you will find answers to your question. This is not unique or specific to CUDA. When you set an environment variable as you are doing, the variable is only set for the current linux shell. If you don’t know what a linux shell is, please google that. When you start a new terminal, you are starting a new shell.

So to make the environment variable “persist”, in each new shell you open, you will need a method to set it automatically in new shells. There are various ways to do it which may be specific to the kind of shell you are using. for example you might set it in your .bashrc file. This is a common question, so with a bit of searching you’ll find useful answers.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.