OS:Centos7
Python:3.5.4
Tensorflow:1.3.0
GCC:4.8.5
bazel:0.5.3
Python:3.5.4
Tensorflow:1.3.0
GCC:4.8.5
bazel:0.5.3
问题1:
按照
$ git clone https://github.com/bazelbuild/bazel.git
$ cd bazel
$ git checkout tags/0.5.3
$ ./compile.sh
安装bazel在编译时会产生问题,git checkout tags/0.1.0是没有问题的,但是tensorflow1.3.0要求使用bazel 0.4.5及以上版本,所以我直接去https://github.com/bazelbuild/bazel/releases下载了bazel-0.5.3-dist.zip , 成功安装。
$ git clone https://github.com/bazelbuild/bazel.git
$ cd bazel
$ git checkout tags/0.5.3
$ ./compile.sh
安装bazel在编译时会产生问题,git checkout tags/0.1.0是没有问题的,但是tensorflow1.3.0要求使用bazel 0.4.5及以上版本,所以我直接去https://github.com/bazelbuild/bazel/releases下载了bazel-0.5.3-dist.zip , 成功安装。
问题2:
执行bazel build -c opt //tensorflow/tools/pip_package:build_pip_package时报错:
ERROR: /root/.cache/bazel/_bazel_alan/4f0802b51328067daa0e8dc06f0ffd42/external/curl/BUILD:28:1: C++ compilation of rule '@curl//:curl' failed (Exit 1).
external/curl/lib/if2ip.c:47:23: fatal error: stropts.h: No such file or directory
# include <stropts.h>
external/curl/lib/if2ip.c:47:23: fatal error: stropts.h: No such file or directory
# include <stropts.h>
缺少stropts.h,手动创建一个空的stropts.h,执行sudo touch /usr/include/stropts.h,问题解决,成功安装
问题3:
导入tensorflow时报错:
Traceback (most recent call last):
File "/opt/soft/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'
File "/opt/soft/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/soft/tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/opt/soft/tensorflow/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/opt/soft/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/opt/soft/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'
File "<stdin>", line 1, in <module>
File "/opt/soft/tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/opt/soft/tensorflow/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/opt/soft/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/opt/soft/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'
.................
闹了个乌龙,我在tensorflow目录下执行的python3,所以导入tensorflow时报了这些错误,切换到其他目录下执行,问题解决。
在安装过程中还遇到了其他一些小问题,缺少依赖,版本问题啊之类的,总之,源码安装坑比较多...