STEP 1.
To make sure you are already installed the proprely Nvidia Driver, or clear all the divers and reinstall, using this instrution the clear:
sudo apt-get remove --purge nvidia-*
Then check which drivers you can install on you computer:
ubuntu-drivers devices
You will get results like below, nvidia-driver-495 is recomended version it will installing default if you use instrction ubuntu drivers autoinstall, you also can dominate the version using:
sudo apt-get install nvidia-driver-450
Using nvidia-smi to check whether the installation is successful
STEP 2
Download CUDA Toolkit 10.2 Download | NVIDIA Developer , I reconmend you download runfile(local) version
Then use the following command to downlod the local file and run the file
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run
Then you will see this window on the left, check continue and input accept next window, you will see this window on the right. X stands for execute, cancle the driver option and istall
If your computer output like that, congratulations,you just need the last step, add seytem path will be Ok.
STEP 3
Input sudo gedit ~/.bashrc at your computer terminal to edit bashrc file ,adding the cuda path at the end of the file, the update this file using source ~/.bashrc
export CUDA_HOME=/usr/local/cuda-10.2/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64
export PATH=$PATH:$LD_LIBRARY_PATH:$CUDA_HOME
All the step is done, input nvcc -V to check whether it works normally.
cat /usr/local/cuda/version.txt
sudo apt-get --fix-broken install
dpkg error: "trying to overwrite file, which is also in..."
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not installed
groovy : Depends: libjline-java but it is not installed
rhino : Depends: libjline-java but it is not installed
E: Unmet dependencies. Try using -f.
To fix your problem run
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libjline-java_1.0-1_all.deb