I believe that many friends have faced with the NVIDIA-driver install problem on the Ubuntu OS. I have dealt with this problem for a day and at last I found a easy way to solve this problem.
First, It is better to install the Ubuntu with a iGPU or AMD GPU, to support the iGPU, we can enter the BIOS while booting the computer and then open the option in Advanced->System Agent Configuration-> Graphics Configuration and set the Primary Display as IGFX. As for me, I used a AMD GPU at the PCIE first slot to enable screen display.
Second, after installing the Ubuntu successfully, we can enter the System Settings and open the Software&Updates, switch to Additional Drivers , select the NVIDIA driver with a appropriate version and push the Apply Changes button to update the NVIDIA GPU driver.
Last, we only need to reboot the system and switch the display port to our NVIDIA GPU. Type nvidia-smi
in terminate and you will see the results as follows.
After installing the NVIDIA-driver, It is easy to install cuda ,cudnn and so on. Then we can have a great fun with them in Machine Learning!!!