vim /etc/profile
在最后加入:
PATH=$PATH:/usr/local/cuda-9.1/bin
export PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/cuda-9.1/lib64
然后保存,退出。
运行:
source /etc/profile
然后再查看环境变量:
[root@localhost cuda]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/cuda-9.1/bin
References:
//www.greatytc.com/p/7abd3eb2fe2d
https://serverfault.com/questions/372987/centos-usr-local-lib-system-wide-ld-library-path