iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 5
0

前言:

tensorflow 這個套件可以利用cpu以及gpu兩種不同的硬體去運算

.由於使用gpu版本需要安裝顯卡驅動 對於有的作業系統較為不友善

所以今天先講解如何安裝cpu版本的tensorflow

因為是利用python去編寫 所以我這邊會利用python的套件管理軟體pip去進行安裝

開始安裝:

於終端機輸入指令

$ sudo pip3 install --upgrade tensorflow
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tensorflow
  Downloading tensorflow-1.4.1-cp35-cp35m-manylinux1_x86_64.whl (40.7MB)
    100% |████████████████████████████████| 40.7MB 40kB/s 
Requirement already up-to-date: wheel>=0.26 in ./.local/lib/python3.5/site-packages (from tensorflow)
Requirement already up-to-date: enum34>=1.1.6 in ./.local/lib/python3.5/site-packages (from tensorflow)
Collecting protobuf>=3.3.0 (from tensorflow)
  Downloading protobuf-3.5.1-cp35-cp35m-manylinux1_x86_64.whl (6.4MB)
    100% |████████████████████████████████| 6.4MB 243kB/s 
Requirement already up-to-date: six>=1.10.0 in ./.local/lib/python3.5/site-packages (from tensorflow)
Requirement already up-to-date: numpy>=1.12.1 in ./.local/lib/python3.5/site-packages (from tensorflow)
Requirement already up-to-date: tensorflow-tensorboard<0.5.0,>=0.4.0rc1 in ./.local/lib/python3.5/site-packages (from tensorflow)
Requirement already up-to-date: setuptools in ./.local/lib/python3.5/site-packages (from protobuf>=3.3.0->tensorflow)
Requirement already up-to-date: werkzeug>=0.11.10 in ./.local/lib/python3.5/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Requirement already up-to-date: bleach==1.5.0 in ./.local/lib/python3.5/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Requirement already up-to-date: markdown>=2.6.8 in ./.local/lib/python3.5/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Requirement already up-to-date: html5lib==0.9999999 in ./.local/lib/python3.5/site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Installing collected packages: protobuf, tensorflow
  Found existing installation: protobuf 3.5.0.post1
    Uninstalling protobuf-3.5.0.post1:
      Successfully uninstalled protobuf-3.5.0.post1
Successfully installed protobuf-3.5.1 tensorflow-1.4.1

等待一定時間後 會跳出最後一行 代表他成功安裝tensorflow-1.4.1

安裝過程中如果有紅字 可以提出詢問筆者 因為筆者一切安裝正常(筆者環境請參照 DAY1前言

測試是否成功:

新增檔案:

使用jupyter notebook 新增一個python檔案 test.py
https://ithelp.ithome.com.tw/upload/images/20171224/20107535N08Z90ydp1.png
新增方法前面教學文件中有教學 忘記的可以向前翻閱(DAY3 jupyter notebook)

執行檔案:

https://ithelp.ithome.com.tw/upload/images/20171224/20107535UgHbbZPl2w.png

成功跳出表示安裝成功


上一篇
DAY4 Tensorflow基本概念
下一篇
DAY6 ubuntu於本機安裝GPU版Tensorflow (上)
系列文
tensorflow python30

尚未有邦友留言

立即登入留言