Cuda10 installing problem, nvidia-smi is not working

I am new to Cuda and Ubunt and Nividai. I was using the PC ubunt 18.6 with Cuda 9 and nvidia-smi was working. I have tried to install cuda 10 . i found a script ti install it , the following is the script in

#!/bin/bash

Install CUDA Toolkit 10

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub && sudo apt update
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb

sudo apt update
sudo apt install -y cuda

Install CuDNN 7 and NCCL 2

wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb

sudo apt update
sudo apt install -y libcudnn7 libcudnn7-dev libnccl2 libc-ares-dev

sudo apt autoremove
sudo apt upgrade

Link libraries to standard locations

sudo mkdir -p /usr/local/cuda-10.0/nccl/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libnccl.so.2 /usr/local/cuda/nccl/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.7 /usr/local/cuda-10.0/lib64/

echo ‘If everything worked fine, reboot now.’

after i reboot , then i have tried o run my code it says no NVIDIA GPU device is present: /dev/nvidia0 does not exist.

nvidia-smi is not working any more , it says Failed to initialize NVML: Driver/library version mismatch.

I have an error form the system , in the following

Check if you are using third party repositories. If so disable them, since they are a common source of problems.
Furthermore run the following command in a Terminal: apt-get install -f
Transaction failed: The package system is broken
The following packages have unmet dependencies:

cuda-libraries-dev-10-1: Depends: libcublas-dev (>= 10.2.0.168) but it is not installed
cuda-samples-10-1: Depends: libcublas-dev (>= 10.2.0.168) but it is not installed
cuda-visual-tools-10-1: Depends: libcublas-dev (>= 10.2.0.168) but it is not installed

And this is my cuda version rifht now when i use the command nvcc --version i Got nvcc: NVIDIA ® Cuda compiler driver Copyright © 2005-2017 NVIDIA Corporation Built on Fri_Nov__3_21:07:56_CDT_2017 Cuda compilation tools, release 9.1, V9.1.85

I hope any one can help me to get my old cuda version that was before and nvidia-smi to be working. Please also write for me the commands so i can use easily . I do not expereince in that stuff before . Thanks a lot

sudo apt-get purge nvidia*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver-430 nvidia-settings
sudo reboot
nvidia-smi

these commands may help you out. Only make sure you to choose required driver in place of 430.
You can find your older version here https://developer.nvidia.com/cuda-toolkit-archive