【问题标题】:Unable to import distributions module from Tensorflow (Dockerized)无法从 Tensorflow 导入分发模块(Dockerized)
【发布时间】:2018-06-10 17:49:50
【问题描述】:

我正在使用本地主机上的 Jupyter UI 运行官方 TF docker repo。似乎 TF 正常工作,因为我可以导入它,但是在尝试导入分发模块时出现错误:

print tf.__version__
import tf.distributions as dist

1.8.0

ImportErrorTraceback (most recent call last)
<ipython-input-3-4d440943cb46> in <module>()
      1 print tf.__version__
----> 2 import tf.distributions as dist

ImportError: No module named tf.distributions

【问题讨论】:

    标签: tensorflow edward


    【解决方案1】:

    试试这个

    import tensorflow as tf
    from tensorflow import distributions as dist
    

    我认为您不能在 python 中为其他导入语句使用导入别名。我不太确定这一点,但我认为这就是问题所在。

    仅供参考,我在 Python 3.5.2 和 Tensorflow 1.8.0 上对此进行了测试

    【讨论】:

      猜你喜欢
      • 2020-10-03
      • 1970-01-01
      • 2014-11-10
      • 2021-01-22
      • 2016-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-14
      相关资源
      最近更新 更多