【问题标题】:Jupyter Notebook Tensorflow MNIST import Error: ImportError: cannot import name batchingJupyter Notebook Tensorflow MNIST 导入错误:ImportError: cannot import name batching
【发布时间】:2018-10-09 20:39:52
【问题描述】:

我尝试在 Jupyter notebook 的应用程序中执行这一行。

from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets

我收到以下错误:

.conda/envs/py27/lib/python2.7/site-packages/tensorflow/contrib/__init__.py in <module>()
     23 
     24 # Add projects here, they will show up under tf.contrib.
---> 25 from tensorflow.contrib import batching
     26 from tensorflow.contrib import bayesflow
     27 from tensorflow.contrib import cloud

ImportError: cannot import name batching

如果我这样运行它,我不会收到此错误:

 python -c "from tensorflow.examples.tutorials.mnist import input_data"

谁能告诉我是什么导致了 Jupyter Notebook 中的错误

【问题讨论】:

    标签: python tensorflow anaconda jupyter-notebook


    【解决方案1】:

    我在从 jupyter notebook 导入库时遇到了类似的问题,问题一直是我忘记在我的新 conda 环境中安装jupyter,但是 jupyter 安装在 root 环境中。

    根据给出的错误,确保您在py27 conda 环境中安装了 jupyter。如果没有安装,会默认在root环境下打开。

    所以在终端:

    source activate py27  # activate py27 if on windows
    conda install jupyter
    

    【讨论】:

      猜你喜欢
      • 2020-07-07
      • 1970-01-01
      • 2021-09-28
      • 2021-09-30
      • 2017-07-10
      • 2011-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多