我正在尝试使用他们的export_png方法从bokeh.io导出一个Bokeh图到png,但是,我遇到了一个RuntimeError,声明在PATH或BOKEH_PHANTOMJS_PATH中不存在PhantomJS。
我正在使用Python3.7.3的木星笔记本环境。
我尝试过conda install -c conda-forge phantomjs和conda install -c conda-forge selenium (以及conda install phantomjs和conda install selenium),但都没有效果。
任何帮助将不胜感激-我很高兴提供更多的细节!
以下是例外情况的一部分:
//anaconda3/lib/python3.7/site-packages/bokeh/io/webdriver.py in create_phantomjs_webdriver()
73 '("conda install -c bokeh selenium" or "pip install selenium")')
74
---> 75 phantomjs_path = detect_phantomjs()
76 return webdriver.PhantomJS(executable_path=phantomjs_path, service_log_path=devnull)
77
//anaconda3/lib/python3.7/site-packages/bokeh/util/dependencies.py in detect_phantomjs(version)
124 except OSError:
125 raise RuntimeError('PhantomJS is not present in PATH or BOKEH_PHANTOMJS_PATH. Try "conda install phantomjs" or \
--> 126 "npm install -g phantomjs-prebuilt"')
127
128 return phantomjs_path
RuntimeError: PhantomJS is not present in PATH or BOKEH_PHANTOMJS_PATH. Try "conda install phantomjs" or "npm install -g phantomjs-prebuilt"发布于 2020-01-15 19:11:57
好吧,所以我想出了解决这个问题的方法.
首先:试试这个:
conda install -c conda-forge phantomjs
如果这不起作用,那么执行以下操作:
我验证了我的phantomjs环境中有anaconda3库(如下所示)。/anaconda3/lib/python3.7/site-packages/phantomjs
问题是,我的木星笔记本在一个不属于anaconda3的环境中工作。
所以我做的是:
1) conda install nb_conda_kernels
2)完全关闭anaconda应用程序。
3)打开anaconda,在“__________上的应用程序”( anaconda主菜单视图中的左上角下拉菜单)下,我选择了"anaconda3“。
4)打开木星实验室(也许木星笔记本也能用)
5)重新执行我的代码和WALA!啊,真灵。
如果你们有什么问题请告诉我。
https://stackoverflow.com/questions/59757002
复制相似问题