Apache Zeppelin:在 Windows 上配置 python 解释器

Apache Zeppelin: configuration of python interpreter on Windows

我在 Windows 上使用 运行 Zeppelin Python 笔记本时遇到一些问题。它看起来像一些输出问题,有几个 SyntaxError: invalid syntax 错误。例如。代码

%python
import numpy as np
print np.random.randn(10)

结果

                    ^
SyntaxError: invalid syntax
[ 0.3144414   0.2340006   0.86525395 -0.24519029 -1.19862891 -0.88127259
 -1.64757093  1.39753151 -0.50873422 -1.39649112]
  File "<stdin>", line 1
    z._displayhook()
                    ^
SyntaxError: invalid syntax
  File "<stdin>", line 1

    ^
SyntaxError: invalid syntax
  File "<stdin>", line 1

类似地,当使用 matplotlib 绘图时,代码被执行,但实际数字未显示(可能是由于输出问题):

%python
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])

报错:

                    ^
SyntaxError: invalid syntax
[<matplotlib.lines.Line2D object at 0x0000000004D737B8>]
  File "<stdin>", line 1
    z._displayhook()
                    ^
SyntaxError: invalid syntax
  File "<stdin>", line 1

    ^
SyntaxError: invalid syntax
  File "<stdin>", line 1
ERROR   

如果有任何建议或帮助,我将不胜感激!

Zeppelin 目前似乎不支持 Windows 使用 python 解释器。您需要使用 VM 启动不同的环境。

https://issues.apache.org/jira/browse/ZEPPELIN-1436

有一个简单的解决方法。在口译员管理部分 在 python 解释器下,将以下 zeppelin.python 属性 值设置为 python -i

zeppelin.python python -i

(使用 v2.7.13 为我工作)