无法加载本机TensorFlow运行时-找不到符号:_clock_gettime

时间:2019-03-18 20:49:19

标签: python macos tensorflow

在加载Tensorflow时遇到了很多问题。我已经卸载并重新安装了numpy(现在是最新的,这是另一个初始错误),已经卸载并重新安装了Tensorflow,并且卸载并重新安装了Nextgenrnn(我打算与之结合使用的软件包)。

启动python并调用“ import tensorflow”,我收到这条非常长的错误消息。

这是完整的堆栈跟踪:

    Traceback (most recent call last):
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "//anaconda/lib/python3.5/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "//anaconda/lib/python3.5/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: dlopen(//anaconda/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
  Referenced from: /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib
 in /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "//anaconda/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "//anaconda/lib/python3.5/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "//anaconda/lib/python3.5/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: dlopen(//anaconda/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
  Referenced from: /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib
 in /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

我不确定如何继续。

我从Anaconda安装了Python 3.5.6,并在OS X El Capitan上运行。

1 个答案:

答案 0 :(得分:1)

在macOS SDK中,clock_gettime的声明如下:__CLOCK_AVAILABILITY int clock_gettime(clockid_t __clock_id, struct timespec *__tp);

,如果我们看一下__CLOCK_AVAILABILITY宏的定义:#define __CLOCK_AVAILABILITY __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)

我们可以看到clock_gettime直到macOS 10.12才被添加到API中。您使用的是macOS 10.11的El Capitan。您需要更新操作系统或降级软件包。