我正试图在Raspberry Pi 3上以无头模式运行Chromium。我从this repository获得了Chromium-chromedriver。我一直得到同样的错误。当我尝试从终端运行铬铬合金时,它说我缺少libgfx.so,经过强烈的寻找,我找不到Raspberry Pi的任何地方。我也试过从终端安装。下面是我的代码以及我尝试的所有内容和相应的错误。此时,任何和所有帮助都表示赞赏。
我的代码:
from selenium.webdriver import Chrome
from contextlib import closing
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
with closing(Chrome(chrome_options=chrome_options)) as driver:
driver.get(URL)
给出错误:
python3 Chromium\ Launch\ Test.py
Traceback (most recent call last):
File "Chromium Launch Test.py", line 3, in <module>
with closing(Chrome(chrome_options=chrome_options)) as driver:
File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
self.service.start()
File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/pi/.local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/lib/chromium-browser/chromedriver unexpectedly exited. Status code was: 12
尝试从终端运行铬铬合金:
/usr/lib/chromium-browser/chromedriver: error while loading shared libraries: libgfx.so: cannot open shared object file: No such file or directory
尝试从终端安装libgfx:
sudo apt install libgfx
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libgfx
字面上没有任何线索去哪儿。在启动之前尝试更新。尝试单独更新存储库中列出的所有依赖库。什么都行不通。