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

相關文章
相關標籤/搜索