我刚刚将 Python Bokeh 升级到 0.12.4 我收到错误 JSON 对象的字符串类型错误。我没有任何本地静态 CDN 库。有一些信息here但这很令人困惑。有人对如何修复有一个简单的答案吗?
注意:我的 Bokeh 在 Jupyter 中运行良好。 Flask Web 嵌入案例失败:
script, div = components(plot) return render_template('graph.html',
script=script, div=div)
其中 graph.html 模板如下所示:
<link
href="http://cdn.bokeh.org/bokeh/release/bokeh-0.12.4.min.css"
rel="stylesheet" type="text/css">
<link
href="http://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.4.min.css"
rel="stylesheet" type="text/css">
<script src="http://cdn.bokeh.org/bokeh/release/bokeh-0.12.4.min.js"></script>
<script src="http://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.4.min.js"></script>
{{ script |safe }}
最佳答案
当我从 bokeh 0.12.6 升级到 bokeh 0.12.14 时,我的 django 模板中出现了同样的错误,所以我添加了相同的 bokeh 静态要求
<link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.14.min.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.14.min.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-tables-0.12.14.min.css" type="text/css">
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.14.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-api-0.12.14.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.14.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-0.12.14.min.js"></script>
关于python-3.x - 我刚刚将 Python Bokeh 升级到 0.12.4 我收到错误 JSON 对象的字符串类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49211950/