1

尝试在硬件上使用 tensorflow(版本-截至发布日期的最新版本)时出现以下错误-带有操作系统的 MacBookPro CPU-virtualenv 中的双启动 Ubuntu 16.04 LTS — 带有 Keras 和 keras-rl 和 python 的无站点包2.7.

...
 Using TensorFlow backend.
2018-02-15 18:55:01,909 [Thread-46   ] [hbp_nrp_cles] [CRITICAL]  Unhandled exception of type <type 'exceptions.RuntimeError'>: module compiled against API version 0xb but this version of numpy is 0xa
2018-02-15 18:55:01,909 [Thread-46   ] [hbp_nrp_cles] [ERROR]  None
Traceback (most recent call last):
  File "/home/akshay/.opt/kerasrl_venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 37, in <module>
    from tensorflow.python import pywrap_dlopen_global_flags
ImportError: cannot import name pywrap_dlopen_global_flags
2018-02-15 18:55:01,910 [Thread-46   ] [hbp_nrp_cles] [CRITICAL]  Unhandled exception of type <type 'exceptions.RuntimeError'>: module compiled against API version 0xb but this version of numpy is 0xa
2018-02-15 18:55:01,910 [Thread-46   ] [hbp_nrp_cles] [ERROR]  None
Traceback (most recent call last):
  File "/home/akshay/.opt/kerasrl_venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 37, in <module>
    from tensorflow.python import pywrap_dlopen_global_flags
ImportError: cannot import name pywrap_dlopen_global_flags
[libprotobuf FATAL external/protobuf_archive/src/google/protobuf/stubs/common.cc:68] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.4.0.  Please update your library.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "google/protobuf/descriptor.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'

...

我用了

site.addsitedir(os.path.expanduser('path/to/tensorflow_venv/lib/python2.7/site-packages'))

在另一个环境中工作时导入 keras-rl 模块

这个 ImportError 是什么意思?我检查了文件 pwrap_tensorflow.py 中的代码,但不理解异常上方的注释。

...
try:
  # This import is expected to fail if there is an explicit shared object
  # dependency (with_framework_lib=true), since we do not need RTLD_GLOBAL.
  from tensorflow.python import pywrap_dlopen_global_flags
  _use_dlopen_global_flags = True
except ImportError:
  _use_dlopen_global_flags = False
... 

我也遇到了一个 protobuf 问题。venv中的protobuf版本是3.5.1

4

0 回答 0