通过 pip 安装后的 Tensorboard 错误

Posted

技术标签:

【中文标题】通过 pip 安装后的 Tensorboard 错误【英文标题】:Tensorboard error after installing via pip 【发布时间】:2017-06-01 04:55:15 【问题描述】:

我最近尝试通过 pip 安装 tensorboard,详见 README.md。安装被认为是成功的,但是当我在安装后尝试运行 tensorboard 时,我不断收到如下所示的导入/未定义符号错误。

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/tensorboard/tensorboard.py", line 32, in <module>
    from tensorflow.python.summary import event_file_inspector as efi
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/python/summary/event_file_inspector.py", line 122, in <module>
    from tensorflow.python.platform import gfile
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/python/platform/gfile.py", line 22, in <module>
    from tensorflow.python.lib.io.file_io import copy as Copy
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/python/lib/io/file_io.py", line 27, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorboard/tensorboard.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow.so: undefined symbol: PyBytes_AsStringAndSize

我在安装过程中遗漏了什么吗?

我能做些什么来解决这个问题?

谢谢!

【问题讨论】:

你好,布拉德,你解决了吗? 【参考方案1】:

上面报错是因为Tensorboard是使用pip3(python 3)安装的,TF env设置为python2.7。

使用pip2 install tensorboard

现在 tensorboard 和 tf env 都设置为 python2

【讨论】:

以上是关于通过 pip 安装后的 Tensorboard 错误的主要内容,如果未能解决你的问题,请参考以下文章

tensorboard开启对性能的影响

centos6,python3,通过pip安装pycurl出现报错提示

关于tensorboard --logdir=logs的报错解决办法记录

tensorboard文件为啥只能放在c盘

python相关的报错处理

使用TensorBoard可视化工具