安装tensorflow-gpu杂项

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Chang_Shuang/article/details/80884853

使用pip的时候在后面加上-i参数,指定pip的下载源
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

cuda8.0安装
1)在终端运行指令 sudo sh cuda_8.0.27_linux.run
选择
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.62?
(y)es/(n)o/(q)uit: n
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /home/zhou ]:
Installing the CUDA Toolkit in /usr/local/cuda-8.0 …
Missing recommended library: libGLU.so
Missing recommended library: libX11.so
Missing recommended library: libXi.so
Missing recommended library: libXmu.so
Installing the CUDA Samples in /home/zhou …
Copying samples to /home/zhou/NVIDIA_CUDA-8.0_Samples now…

Finished copying samples.

= Summary =

Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-8.0
Samples: Installed in /home/zhou, but missing recommended libraries
Please make sure that
- PATH includes /usr/local/cuda-8.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 361.00 is required for CUDA 8.0 functionality to work.
To install the driver using this installer, run the following command, replacing with the name of this run file:
sudo .run -silent -driver
Logfile is /tmp/cuda_install_2961.log
安装完成,但是缺少一些库。
2)安装所缺少的库
sudo apt-get upgrade -y
sudo apt-get update
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev -y

注意:在执行这一步如果遇到类似这样一个问题:
unity-control-center : 依赖: libcheese-gtk23 (>= 3.4.0) 但是它将不会被安装
依赖: libcheese7 (>= 3.0.1) 但是它将不会被安装
E: 错误,pkgProblemResolver::Resolve 发生故障,这可能是有软件包被要求保持现状的缘故。
解决方案:
先安装一个aptitude, 即在终端输入:
sudo apt-get install aptitude
安装完之后,使用此工具安装qt-sdk可用。即在终端输入:
sudo aptitude install qt-sdk
随后再执行bash install-deps;

3) 设置环境变量
在终端输入这两句:
export PATH=/usr/local/cuda-8.0/bin: P A T H e x p o r t L D L I B R A R Y P A T H = / u s r / l o c a l / c u d a 8.0 / l i b 64 : LD_LIBRARY_PATH

if you are installing cuda-7.5
Please make sure that
- PATH includes /usr/local/cuda-7.5/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-7.5/lib64,
export PATH=/usr/local/cuda-7.5/bin: P A T H e x p o r t L D L I B R A R Y P A T H = / u s r / l o c a l / c u d a 7.5 / l i b 64 : LD_LIBRARY_PATH
add /usr/local/cuda-7.5/lib64 to /etc/ld.so.conf
ldconfig

然后修改文件中环境变量设置
sudo gedit /etc/profile
输入上面export的两句
export PATH=/usr/local/cuda-8.0/bin: P A T H e x p o r t L D L I B R A R Y P A T H = / u s r / l o c a l / c u d a 8.0 / l i b 64 : LD_LIBRARY_PATH
保存,退出。
sudo ldconfig //环境变量立即生效
4) 验证安装是否完成
nvidia-smi
显示:
nvcc –version
显示:
nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016
NVIDIA Corporation Built on Wed_May__4_21:01:56_CDT_2016 Cuda
compilation tools, release 8.0, V8.0.26

cuda测试 cudnn安装

安装annconda找不到conda
可以选择用命令把路径写入bashrc文件:
echo “export PATH=”~/anaconda2/bin:”$PATH ” >> ~/.bashrc
使用source ~/.bashrc(或者 . ~/.bashrc)就可以立刻加载修改后的设置,使之生效。

“libcudart.so.8.0 cannot open shared object file: No such file or directory”
解决办法是将一些文件复制到/usr/local/lib文件夹下:

注意自己CUDA的版本号!

sudo cp /usr/local/cuda-8.0/lib64/libcudart.so.8.0 /usr/local/lib/libcudart.so.8.0 && sudo ldconfig
sudo cp /usr/local/cuda-8.0/lib64/libcublas.so.8.0 /usr/local/lib/libcublas.so.8.0 && sudo ldconfig
sudo cp /usr/local/cuda-8.0/lib64/libcurand.so.8.0 /usr/local/lib/libcurand.so.8.0 && sudo ldconfig

解决方法:sudo ldconfig /usr/local/cuda/lib64

猜你喜欢

转载自blog.csdn.net/Chang_Shuang/article/details/80884853