【问题标题】:set executable PATH in Jupyter Notebook on google cloud cluster Python3在谷歌云集群 Python3 上的 Jupyter Notebook 中设置可执行路径
【发布时间】:2017-11-05 20:44:45
【问题描述】:

我通过以下步骤在我的谷歌云集群上打开了 jupyter notebook:https://cloud.google.com/dataproc/docs/tutorials/jupyter-notebook 现在我收到这段代码的错误:

import selenium  
from contextlib import closing  
from selenium.webdriver import PhantomJS  
with closing(PhantomJS()) as browser:  
     #some further code

我收到以下错误消息:

WebDriverException:消息:“phantomjs”可执行文件需要在 PATH 中。

现在在我自己的环境中,当我遇到这个错误时,我通过在我的系统变量中添加我的 phantomjs.exe 的路径来修复它。 但是现在当我在谷歌云集群环境中时,我正在寻找另一种添加 phantomjs.exe 路径的方法。任何其他解决方案也将不胜感激。

【问题讨论】:

    标签: python-3.x selenium-webdriver jupyter-notebook google-cloud-dataproc executable-path


    【解决方案1】:

    我没有使用 Selenium 或 PhantomJS 的经验。但是,由于 Dataproc 在 Debian 8 Jessie 而不是 Windows 上运行,您可能希望运行 sudo apt-get install phantomjs 而不是使用 exe。您可以在 SSH 之后手动安装它,也可以在 initialization action 中安装它。

    【讨论】:

    • 是的,这非常有帮助,我设法在集群上的 gcloud shell 中运行了您的代码行,并将 PhantomJS 下载到集群中。现在我面临另一个错误(在同一段代码上)。 'WebDriverException:消息:服务 phantomjs 意外退出。状态码是:-6'。有什么想法吗?
    猜你喜欢
    • 2019-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-22
    • 2017-08-11
    • 1970-01-01
    • 2019-03-06
    • 2020-10-31
    相关资源
    最近更新 更多