我有一个python脚本,在我的桌面上没有任何错误。当我尝试在我的覆盆子pi上运行它时,我遇到了错误。
要在python 3.5的raspberry pi上安装tensorflow,我遵循了本教程:https://petewarden.com/2017/08/20/cross-compiling-tensorflow-for-the-raspberry-pi/ tensorflow和python 3.5没有官方二进制文件,当我尝试自己编译时,我遇到了错误。该教程建议只安装Python 3.4二进制文件中的tensorflow。
如果你正在运行Python 3.5,你可以使用Python 3.4轮,但是使用 稍微改变文件名,因为它编码版本。您 每次导入tensorflow都会看到几个警告,但它 应该正常工作。
以下是我遇到的错误:
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
return f(*args, **kwds)
Traceback (most recent call last):
File "run.py", line 93, in <module>
model = FastPredict(tf.contrib.learn.Estimator(model_fn=convolutional_neural_network, model_dir="tmp"))
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/util/lazy_loader.py", line 53, in __getattr__
module = self._load()
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/util/lazy_loader.py", line 42, in _load
module = importlib.import_module(self.__name__)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/__init__.py", line 82, in <module>
from tensorflow.contrib.eager.python import tfe as eager
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/eager/python/tfe.py", line 76, in <module>
from tensorflow.contrib.eager.python.datasets import Iterator
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/eager/python/datasets.py", line 23, in <module>
from tensorflow.contrib.data.python.ops import prefetching_ops
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/data/python/ops/prefetching_ops.py", line 25, in <module>
resource_loader.get_path_to_datafile("../../_prefetching_ops.so"))
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/util/loader.py", line 55, in load_op_library
ret = load_library.load_op_library(path)
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
File "/home/pi/.local/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /home/pi/.local/lib/python3.5/site-packages/tensorflow/contrib/data/python/ops/../../_prefetching_ops.so: undefined symbol: _ZN6google8protobuf8internal26fixed_address_empty_stringE
第93行尝试创建导致错误的Estimator。
tf.contrib.learn.Estimator(model_fn=convolutional_neural_network, model_dir="tmp")
我在github上发现了类似的错误,但没有帮助:https://github.com/tensorflow/serving/issues/684
答案 0 :(得分:0)