【问题标题】:Tensorflow module exists but notebook gives errorTensorFlow 模块存在,但笔记本出现错误
【发布时间】:2017-05-17 10:36:23
【问题描述】:

您好,我正在使用 Jupyter notebook 运行我的 python 脚本。我完成了安装 tensorflow 的所有步骤。当我列出 env 时,我看到安装了 tensorflow,但是当我使用 tensor flow 编写脚本时。我收到以下错误。

ImportError                               Traceback (most recent call last)
<ipython-input-1-b2d6c7d62f65> in <module>()
      2 import numpy as np
      3 #import tflearn
----> 4 import tensorflow as tf
      5 import tflearn
      6 #from tflearn.data_utils import to_categorical

ImportError: No module named 'tensorflow'

谁能帮忙调试一下

我已按照以下步骤操作 1.conda create --name test python=3.5 2.激活测试 3.conda安装numpy matplotlib pandas jupyter notebook 4. conda 安装tensorflow scipy

所有安装都成功了。除了在 hdf5 中我得到错误说 revuild using conda > 2.0

【问题讨论】:

  • 尝试使用 pip 而不是 conda 安装 tensorflow,因为开发人员不支持 conda 版本。您能否提供有关您的操作系统的更多信息并确认您仅使用 CPU 版本?

标签: python tensorflow


【解决方案1】:

如果您尝试在 ipython 中导入 tensorflow,还应确保 ipython 安装在同一环境中。如果你跑

ipython notebook

这将启动默认的 ipython (/usr/bin/ipython)。你不想要那个。所以,改为运行 venv/bin/ipython

【讨论】:

    猜你喜欢
    • 2017-07-31
    • 2022-11-02
    • 2021-08-17
    • 2019-07-28
    • 2021-02-13
    • 2019-06-10
    • 2021-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多