TensorFlow編譯

跑了下iOS的demo

0.jpeg


我的服務(wù)器是ubuntu12.04 32位的系統(tǒng)(建議用16.04 64位)

問題集:

  • 問題1
Sorry, command-not-found has crashed! Please file a bug report at

解決辦法:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
  • 問題2
gcc: error: unrecognized option ‘--std=c++11’

解決辦法:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

Note: 如果add-apt-repository不認(rèn)
sudo apt-get install --reinstall software-properties-common
sudo apt-get install python-software-properties

sudo apt-get update
sudo apt-get install g++-4.8 
sudo apt-get install gcc-4.8
至此,g++-4.8 和 gcc-4.8已經(jīng)安裝,但還未被設(shè)為默認(rèn)。再執(zhí)行下面的命令切換鏈接。
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.8 /usr/bin/g++
  • 問題3
threadpool.cc:(.text+0xb9): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

解決辦法:

vi tensorflow/contrib/makefile/Makefile

HOST_LIBS := \
-lstdc++ \
-lprotobuf \
-lpthread \
-lm \
-lz \
-lrt   //加上這個(gè)

虛擬機(jī)安裝16.04

root@ubuntu:/home/share# pip install --upgrade tensorflow-1.0.1-cp27-none-linux_x86_64.whl
Processing ./tensorflow-1.0.1-cp27-none-linux_x86_64.whl
Collecting mock>=2.0.0 (from tensorflow==1.0.1)
  Downloading mock-2.0.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 45kB/s 
Collecting numpy>=1.11.0 (from tensorflow==1.0.1)
  Downloading numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl (16.5MB)
    100% |████████████████████████████████| 16.5MB 21kB/s 
Collecting protobuf>=3.1.0 (from tensorflow==1.0.1)
  Downloading protobuf-3.3.0-cp27-cp27mu-manylinux1_x86_64.whl (5.7MB)
    100% |████████████████████████████████| 5.7MB 32kB/s 
Requirement already up-to-date: wheel in /usr/lib/python2.7/dist-packages (from tensorflow==1.0.1)
Collecting six>=1.10.0 (from tensorflow==1.0.1)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting funcsigs>=1; python_version < "3.3" (from mock>=2.0.0->tensorflow==1.0.1)
  Downloading funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock>=2.0.0->tensorflow==1.0.1)
  Downloading pbr-3.0.1-py2.py3-none-any.whl (99kB)
    100% |████████████████████████████████| 102kB 46kB/s 
Collecting setuptools (from protobuf>=3.1.0->tensorflow==1.0.1)
  Downloading setuptools-35.0.2-py2.py3-none-any.whl (390kB)
    100% |████████████████████████████████| 399kB 108kB/s 
Collecting appdirs>=1.4.0 (from setuptools->protobuf>=3.1.0->tensorflow==1.0.1)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools->protobuf>=3.1.0->tensorflow==1.0.1)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools->protobuf>=3.1.0->tensorflow==1.0.1)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 43kB/s 
Installing collected packages: six, funcsigs, pbr, mock, numpy, appdirs, pyparsing, packaging, setuptools, protobuf, tensorflow
  Found existing installation: numpy 1.11.0
    Uninstalling numpy-1.11.0:
      Successfully uninstalled numpy-1.11.0
  Found existing installation: setuptools 20.7.0
    Uninstalling setuptools-20.7.0:
      Successfully uninstalled setuptools-20.7.0
Successfully installed appdirs-1.4.3 funcsigs-1.0.2 mock-2.0.0 numpy-1.12.1 packaging-16.8 pbr-3.0.1 protobuf-3.3.0 pyparsing-2.2.0 setuptools-35.0.2 six-1.10.0 tensorflow-1.0.1
  • 測(cè)試導(dǎo)入import tensorflow as tf

  • Ubuntu編譯Android版本
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容