首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure Machine Learning在管道上安装chromedriver

Azure Machine Learning在管道上安装chromedriver
EN

Stack Overflow用户
提问于 2021-10-14 08:18:54
回答 1查看 57关注 0票数 0

我正尝试在管道上运行我的python脚本(使用chromedriver),以便能够从Azure数据工厂调用它。

当我运行管道时,我得到了chromedriver isn at path的错误。这个脚本在我的本地环境中工作得很好。我还尝试根据我的python脚本中的以下代码安装chromedriver。

代码语言:javascript
复制
import os
os.system('sudo apt-get install unzip')
os.system('wget -N https://chromedriver.storage.googleapis.com/94.0.4606.61/chromedriver_linux64.zip -P ~/Downloads')
os.system('unzip ~/Downloads/chromedriver_linux64.zip -d ~/Downloads')
os.system('sudo mv -f ~/Downloads/chromedriver /usr/local/share/')
os.system('sudo chmod +x /usr/local/share/chromedriver')
os.system('sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver')
os.system('sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver')

如何在脚本中调用chrome驱动:

代码语言:javascript
复制
options= Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('window-size=1920,1080')
options.add_argument('--headless')
options.add_experimental_option('w3c', False)
driver = webdriver.Chrome(executable_path=r'/usr/bin/chromedriver',chrome_options=options)

运行流水线时出现以下错误:

代码语言:javascript
复制
ActivityFailedException: ActivityFailedException:
    Message: Activity Failed:
{
    "error": {
        "code": "UserError",
        "message": "User program failed with WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home\n",
        "messageParameters": {},
        "detailsUri": "https://aka.ms/azureml-run-troubleshooting",
        "details": []
    },
    "time": "0001-01-01T00:00:00.000Z"
}
    InnerException None
    ErrorResponse 
{
    "error": {
        "message": "Activity Failed:\n{\n    \"error\": {\n        \"code\": \"UserError\",\n        \"message\": \"User program failed with WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home\\n\",\n        \"messageParameters\": {},\n        \"detailsUri\": \"https://aka.ms/azureml-run-troubleshooting\",\n        \"details\": []\n    },\n    \"time\": \"0001-01-01T00:00:00.000Z\"\n}"
    }
}

谢谢您抽时间见我。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-23 20:05:36

使用dockerfile创建一个新的环境,并根据需要安装chrome解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69567330

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档