ubuntu16.04LTS安裝tensorflow1.1.0(pip方式/python2.7版本/cpu版本)

打開終端,輸入:

sudo apt-get install python-pip python-dev

輸入你自己的密碼,回車,繼續安裝;
輸入y,回車,繼續安裝,等待安裝完成。

以上語句可以簡單理解微安裝tensorflow所必需的環境設置。

繼續輸入:

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp27-none-linux_x86_64.whl

這時候可能有錯誤發生:
(可能是pip版本過低,那就先升級pip)
(可能是Network is unreachable(你懂得),那就多試幾次)

錯誤解決後,等待安裝完成,接下來看看是否安裝成功
在終端輸入

python

進入python環境,輸入:

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

大功告成~

發佈了143 篇原創文章 · 獲贊 38 · 訪問量 26萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章