我以前在我的机器上安装了cuda-7.0,后来卸载了cuda-7.0并安装了cuda-8.0。当我转到我的/ usr / local文件夹时,我看到以下文件夹:
/bin/
/cuda/
/cuda-7.0/
/cuda-8.0/
/etc/
/games/
/include/
/lib/
/lua/
/man/
/MATLAB/
/sbin/
/share/
/src/
我想我很困惑,因为/cuda/version.txt文件说它是在cuda-8.0上,但当我输入时:
$ nvcc -V
它报告我使用的是7.0版:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Mon_Feb_16_22:59:02_CST_2015
Cuda compilation tools, release 7.0, V7.0.27
令我感到困惑的是,即使我这样做了:
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
export PATH=$PATH:/usr/local/cuda-8.0/bin
输入$ nvcc -V
后,仍会输出7.0版。
编辑:
$ which nvcc
/usr/local/cuda-7.0/bin/nvcc
$ echo $PATH
/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/home/arturo/torch/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/cuda-7.0/bin
答案 0 :(得分:25)
评论中建议的解决方案:
export PATH=/usr/local/cuda-8.0/bin:$PATH
问题是$PATH
的排序,我之前的命令有=$PATH:/usr/local...
而不是=/usr/local....:$PATH
答案 1 :(得分:6)
从cuda-8.0升级到cuda-9.2后,我遇到了类似的问题。
解决方案是更改 .bashrc 文件中的以下内容:
export CUDA_HOME="/usr/local/cuda-9.2"
export LD_LIBRARY_PATH="/usr/local/cuda-9.2/lib64":$LD_LIBRARY_PATH
export PATH="/usr/local/cuda-9.2/bin:$PATH"