You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS 7下NVIDIA驱动已安装但nvidia-smi无法调用问题求助

Solution for nvidia-smi Not Found and CUDA Installation on CentOS 7

Hey there, let's work through your issues one by one:

a) Fixing the nvidia-smi: command not found error

Since you've confirmed the NVIDIA kernel module is installed (via cat /proc/driver/nvidia/version), the most likely issue is that the directory containing nvidia-smi isn't in your system's PATH environment variable. Here's how to fix it:

  1. Locate the nvidia-smi executable
    Run this command to find where the binary is stored (it might take a minute):

    find / -name nvidia-smi 2>/dev/null
    

    Common locations on CentOS 7 are /usr/bin/nvidia-smi or /usr/local/nvidia/bin/nvidia-smi.

  2. Add the directory to your PATH

    • Temporary fix (applies only to your current session):
      If the path was /usr/local/nvidia/bin, run:
      export PATH=$PATH:/usr/local/nvidia/bin
      
      Test it by running nvidia-smi right after.
    • Permanent fix (persists across reboots):
      Edit your bash profile to add the path permanently:
      echo 'export PATH=$PATH:/usr/local/nvidia/bin' >> ~/.bashrc
      
      Then reload the profile:
      source ~/.bashrc
      
      Now nvidia-smi should work every time you log in.

If the find command doesn't return any results, it might mean the full NVIDIA driver package wasn't installed (only the kernel module). In that case, you'll need to reinstall the driver package that includes user-space tools like nvidia-smi.


b) Installing CUDA on CentOS 7

First, note the driver-CUDA compatibility: Your NVIDIA driver version is 390.30, which supports CUDA 9.0 (minimum required driver for CUDA 9.0 is 384.81) or older versions. CUDA 9.1 and newer require a driver version ≥390.46, which is higher than your current 390.30, so stick with CUDA 9.0 for compatibility.

Follow these steps:

  1. Install required dependencies
    Ensure you have the necessary development tools and kernel headers:

    sudo yum install -y gcc gcc-c++ kernel-devel kernel-headers
    

    Your existing GCC 4.8.5 is compatible with CUDA 9.0, so no need to upgrade it.

  2. Run the CUDA installer
    Grab the CentOS 7 runfile installer (avoid the RPM version if you want to skip driver installation, since you already have a working driver). Make it executable and run with sudo:

    chmod +x cuda_9.0.176_384.81_linux.run
    sudo sh cuda_9.0.176_384.81_linux.run
    

    When prompted:

    • Do you accept the EULA? Type accept
    • Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? Select no (you already have a newer driver installed)
    • Install the CUDA 9.0 Toolkit? Select yes
    • Install the CUDA 9.0 Samples? Select yes (optional but useful for testing)
    • Choose your preferred installation paths (defaults are usually fine)
  3. Configure CUDA environment variables
    Add CUDA's binary and library paths to your profile:

    echo 'export PATH=$PATH:/usr/local/cuda-9.0/bin' >> ~/.bashrc
    echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64' >> ~/.bashrc
    source ~/.bashrc
    
  4. Verify the installation
    Check the CUDA compiler version:

    nvcc -V
    

    You can also run the device query sample to confirm CUDA recognizes your GPU:

    cd /usr/local/cuda-9.0/samples/1_Utilities/deviceQuery
    make
    ./deviceQuery
    

    If it outputs a Result = PASS, your CUDA installation is working correctly.


内容的提问来源于stack exchange,提问作者AruniRC

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:55:47