【问题标题】:Import Error when trying to use TensorFlow尝试使用 TensorFlow 时出现导入错误
【发布时间】:2017-10-24 12:08:26
【问题描述】:

我对 TensorFlow 还很陌生,只是安装了仅支持 CPU 的版本,如下:https://www.tensorflow.org/install/install_linux 我的 Ubuntu 是 16.04,安装的 python 是 2.7.13。我选择了“native” pip 安装。

下载和安装过程很顺利,但是,当我尝试导入 Tensorflow 并使用它时,它返回以下错误;

ImportError: /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: PyUnicodeUCS4_FromString

我不知道如何在谷歌爬行后解决它。 如果您知道如何解决这个问题并能给我一些建议,非常感谢。
非常感谢您!

【问题讨论】:

  • 我之前在 TensorFlow 中没有看到过这个特殊错误,但是stackoverflow.com/questions/12805044/… 中提到了一个可能相关的一般 Python 问题(尽管很遗憾那里没有好的解决方案)。

标签: python-2.7 tensorflow pip importerror undefined-symbol


【解决方案1】:

这是因为你的 python 是用 UCS2 构建的,它与 tensorflow (UCS4) 假设的不兼容。因此,我猜无论是使用 UCS4 (--enable-unicode=ucs4) 构建 python 还是从源代码构建 tensorflow 都可以解决这个问题。

【讨论】:

    猜你喜欢
    • 2018-04-14
    • 2020-03-21
    • 1970-01-01
    • 2021-10-21
    • 1970-01-01
    • 2022-08-08
    • 2022-08-12
    • 2019-09-29
    • 1970-01-01
    相关资源
    最近更新 更多