打开bash_profile:
sudo gedit ~/.bash_profile
在打开的文本末尾加入:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" export CUDA_HOME=/usr/local/cuda
保存退出后通过如下命令使环境变量生效:
source ~/.bash_profile
还看到一个方法:
sudo vim ~/.bashrc
按i按键:
来编辑.bashrc配置文件,到文件最后,写入下面几句话(直接复制就行) export PATH=/usr/local/cuda-9.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64$LD_LIBRARY_PATH
Ubuntu18.04下安装深度学习框架Pytorch(GPU加速)
https://blog.csdn.net/wuzhiwuweisun/article/details/82753403