Bokeh每当我尝试运行export_png时都会抛出RuntimeError

问题描述 投票:0回答:1

我刚刚更新了我的所有python软件包,并且我的某些脚本无法正常工作。具体地说,Bokeh的export_png功能有问题。

通常,这只是将我的图表的副本保存到特定目录。现在我收到此错误:

Traceback (most recent call last):

  File "C:\Users\ethan\projects\health\chart.py", line 112, in <module>
    p = column(make_chart(False), make_chart(True))

  File "C:\Users\ethan\projects\health\chart.py", line 106, in make_chart
    export_png(p, filename = name + '.png')

  File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\io\export.py", line 97, in export_png
    image = get_screenshot_as_png(obj, width=width, height=height, driver=webdriver, timeout=timeout)

  File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\io\export.py", line 201, in get_screenshot_as_png
    web_driver = driver if driver is not None else webdriver_control.get()

  File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\io\webdriver.py", line 118, in get
    self.current = self.create()

  File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\io\webdriver.py", line 122, in create
    driver = self._create(kind)

  File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\io\webdriver.py", line 140, in _create
    raise RuntimeError("Neither firefox and geckodriver nor a variant of chromium browser and " \

RuntimeError: Neither firefox and geckodriver nor a variant of chromium browser and chromedriver are available on system PATH. You can install the former with 'conda install -c conda-forge firefox geckodriver'.

Chrome在我现在正在使用的计算机上运行良好。我不确定为什么bokeh需要为此使用浏览器,因为我只是制作一个png文件,但是有没有办法解决此问题而不安装Firefox?我希望继续使用Chrome。

python bokeh
1个回答
0
投票

我不确定为什么bokeh需要为此使用浏览器,因为我只是在制作png文件

这是因为要创建该PNG文件,需要呈现Bokeh创建的HTML文档。以前,Bokeh为此使用了PhantomJS,但该项目现在已过时且无需维护。

有没有在不安装Firefox的情况下解决此问题的方法?

如错误消息所述,如果要使用Chrome浏览器(Chrome浏览器是Chrome),则必须在路径上输入chromedriver。如果使用conda,则可以尝试通过conda install -c conda-forge python-chromedriver-binary在与Bokeh相同的环境中进行安装。

© www.soinside.com 2019 - 2024. All rights reserved.