ubuntu-14.04安装最新tensorflow记录


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

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.deblinux

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++ c++

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

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/pip3ubuntu


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

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
>>>orm

相关文章
相关标签/搜索