[Solve the problem: Failed to initialize NVML: Driver/library version mismatch]
First, you need to check the driver kernel version, terminal input:
cat /proc/driver/nvidia/version
For example, what I show here is 440.100, remember this number; then uninstall the driver, terminal input:
sudo apt-get purge nvidia*
Terminal input:
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
Finally, reinstall the driver, you need to replace "440" with the version number just found:
sudo apt-get install nvidia-driver-440 nvidia-settings nvidia-prime
hlx2@NLP:~/desktop/pycharm-community-2018.2.3/bin$ sudo apt-get install nvidia-driver-440 nvidia-settings nvidia-prime
is reading the package list...Complete
the dependencies of the package being analyzed The relationship tree
is reading status information... Complete
E: Unable to locate the software package nvidia-driver-440
Download and install:
sudo systemctl stop lightdm
sudo sh NVIDIA-Linux-x86_64-440.82.run
There appears to already be a driver installed on your system (version:
440.82). As part of installing this driver (version: 440.82), the existing
driver will be uninstalled. Are you sure you want to continue?
选择 Continue installation
The distribution-provided pre-install script failed! Are you sure you want
to continue?
选择 Continue installation
WARNING: Unable to find a suitable destination to install 32-bit
compatibility libraries. Your system may not be set up for 32-bit
compatibility. 32-bit compatibility files will not be installed; if
you wish to install them, re-run the installation and set a valid
directory with the --compat32-libdir option.
选择 ok
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later?
选择 No 继续。
问题大概是:Nvidia’s 32-bit compatibility libraries?
选择 No 继续。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up.
选择 Yes 继续
https://www.nvidia.cn/geforce/drivers/
Search results drop down....
Disable updates:
sudo apt-mark hold nvidia-driver-440
It's OK here, enter nvidia-smi in the terminal to see if the graphics card information appears, if any, you're done!
Reference link: Failed to initialize NVML: Driver/library version mismatch in Ubuntu