在安装了zeppelin,Anaconda和tensorflow的服务器上运行良好。但是当我想在齐柏林飞艇上划下代码时如下:
%python
import pandas as pd
import tensorflow as tf
并运行此代码,我遇到了这样的错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 71, in <module>
from tensorflow.python.framework.framework_lib import *
File "/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/framework_lib.py", line 73, in <module>
from tensorflow.python.framework.ops import Graph
File "/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 41, in <module>
from tensorflow.python.framework import registry
File "/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/registry.py", line 28, in <module>
from tensorflow.python.platform import tf_logging as logging
File "/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/tf_logging.py", line 53, in <module>
if _interactive:
NameError: name '_interactive' is not defined
如何解决这个问题。我没有谷歌这个解决方案。
答案 0 :(得分:0)
最后,我修复了文件
像这样:/home/hadoop/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/tf_logging.py
# If we are in an interactive environment (like jupyter), set loglevel to info
# and pipe the output to stdout
if True:
#if _interactive:
_logger.setLevel(INFO)
_logging_target = _sys.stdout
else:
_logging_target = _sys.stderr
并重新启动zeppelin的python解释器。它工作正常!
答案 1 :(得分:0)
tensorflow项目中有一个问题:https://github.com/tensorflow/tensorflow/pull/8420
他们通过使用默认值False
实现_interactive来修复它# If we are in an interactive environment (like jupyter), set loglevel to info
# and pipe the output to stdout
_interactive = False
if _interactive:
_logger.setLevel(INFO)
_logging_target = _sys.stdout
else:
_logging_target = _sys.stderr
最好是在错误修复程序包含在发行版中时立即更新tensorflow,或者像上面提到的提交中那样更新/site-packages/tensorflow/python/platform/tf_logging.py。
此致 卢瓦克