python - undefined symbol : clock_gettime with tensorflow on ubuntu14. 04

标签 python ubuntu tensorflow

我已经使用 bazel 从源代码安装了 tensorflow。但是当我在 python 中导入 tensorflow 时,错误发生了。

>>> import tensorflow as tf

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 8, in <module>
    from tensorflow.python import *
  File "/home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 34, in <module>
    from tensorflow.python.client.client_lib import *
  File "/home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/client_lib.py", line 39, in <module> 
    from tensorflow.python.client.session import InteractiveSession
  File "/home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 16, in <module>
    from tensorflow.python import pywrap_tensorflow as tf_session
  File "/home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 26, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 22, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: /home/zjuese/anaconda2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so: undefined symbol: clock_gettime

我现在该如何解决?

最佳答案

尝试在链接步骤中添加 rt 库,就像这个差异:

--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -284,7 +284,7 @@ _py_wrap_cc = rule(attrs={

 def tf_extension_linkopts():
-  return []  # No extension link opts
+  return ["-lrt"]

另见 github issue .

关于python - undefined symbol : clock_gettime with tensorflow on ubuntu14. 04,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33980109/

相关文章:

python - 如何使用Appium和Python定位元素?

ubuntu - MPJ Express 挂起

C++ Eigen : dynamic tensor

android - TensorFlow Lite 和 Android Things - 定位检测到的对象并将它们存储在 RectF 对象中?

Python - 无法导入 vlc 模块

python - Flask 教程 : Why do we use the app context for the DB connection?

Python 加速 : reading data from mongodb slow

json - 将 JSON 文件中的所有时间戳转换为 bash 中的 unix 时间戳(Ubuntu)

ubuntu - pdfLaTeX 微型包的字体错误

javascript - TensorflowJS 异步预测