我正尝试在管道上运行我的python脚本(使用chromedriver),以便能够从Azure数据工厂调用它。
当我运行管道时,我得到了chromedriver isn at path的错误。这个脚本在我的本地环境中工作得很好。我还尝试根据我的python脚本中的以下代码安装chromedriver。
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驱动:
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)运行流水线时出现以下错误:
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}"
}
}谢谢您抽时间见我。
发布于 2021-10-23 20:05:36
使用dockerfile创建一个新的环境,并根据需要安装chrome解决了这个问题。
https://stackoverflow.com/questions/69567330
复制相似问题