散景无法将生成的HTML页面加载到浏览器 [英] Bokeh Failed to Load Generated HTML Page to the Browser

查看:70
本文介绍了散景无法将生成的HTML页面加载到浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用bokeh生成图并保存到磁盘,然后在浏览器中显示它.在浏览器中将打开一个新页面,然后该页面的标题以外的任何内容都不会显示在屏幕上.

I am using bokeh to generate a plot and save to a disk and then show it on the browser. A new page will open in the browser and then nothing is display on the screen except the title of that page.

这是我写的代码:

from bokeh.plotting import figure, show, output_file
p = figure(title="Basic Title", plot_width=300, plot_height=300)
p.circle([1,2], [3,4])
output_file("test.html")
show(p)

推荐答案

您显然正在运行从GitHub源安装的Bokeh.在这种情况下,您必须使用内联"资源. CDN资源仅针对完整发行版,发行候选版和"dev"版本发布.我们不会为每次提交发布CDN资源,因此在CDN上绝不会是像dev13+2.<hash>.min.js那样的版本.

You are evidently running of Bokeh installed from GitHub source. In this case you must use "inline" resources. CDN resources are only published for full releases, release candidates, and "dev" builds. We do not publish CDN resources for every commit, so there will never be versions like dev13+2.<hash>.min.js available on CDN.

使用内联资源的一种简单方法是设置BOKEH_RESOURCES环境变量:

An easy way to use inline resources is to set the BOKEH_RESOURCES environment variable:

BOKEH_RESOURCES=inline python myscript.py

当然,另一种选择是安装实际发行版,而不是从源代码安装.

Of course the other alternative is to install a real release instead of installing from source.

这篇关于散景无法将生成的HTML页面加载到浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆