TensorFlow编译
2017-02-14 本文已影响242人
南风无影
-
Mac编译iOS版本
tensorflow 在 iOS 平台上的应用
跑了下iOS的demo
0.jpeg-
Ubuntu编译x86版本
官方步骤
我的服务器是ubuntu12.04 32位的系统(建议用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不认
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已经安装,但还未被设为默认。再执行下面的命令切换链接。
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 //加上这个
虚拟机安装16.04
- 下载tensorflow
wget https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl - 安装
pip install --upgrade tensorflow-1.0.1-cp27-none-linux_x86_64.whl
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
- 测试导入import tensorflow as tf
- Ubuntu编译Android版本