ubuntu-14.04安装最新tensorflow记录

1.安装英伟达驱动
./NVIDIA-Linux-x86_64-384.69.run
nvidia-smi成功表示驱动ok

2.安装cuda
dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda
安装patch2(也可以不装)dpkg -i cuda-repo-ubuntu1404-8-0-local-cublas-performance-update_8.0.61-1_amd64.deb

3.降低gcc版本到5.0以下(ubuntu-14不需要,因为已经是gcc-4.8.4,ubuntu-16才要)
sudo apt-get install g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++

4.安装cudnn
tar zxf cudnn-8.0-linux-x64-v6.0.solitairetheme8
把cuda下的文件拷贝到/usr/local/cuda

5.python3及tensorflow
apt-get remove python2.7
apt-get install python3.5
cd /usr/bin
ln -s python3.5 python
一定要确保运行python版本是3.5.x
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
sudo pip3 install setuptools --upgrade
sudo pip3 install ipython
cp /usr/local/bin/pip3.5 /usr/bin/pip3

6.安装tensorflow
pip3 install tensorflow-gpu==1.2
说明:tensorflow-1.2是2017.6发布的版本,应该足够

7.测试:
$ python

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> sess.run(hello)
'Hello, TensorFlow!'
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a + b)
42
>>>

上一篇:命令行创建畸形文件夹+畸形目录管理工具(DeformityPath)


下一篇:Unity-视图操作