unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=...)

linux下命令行运行报错
Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.14.0-deepin2-amd64 x86_64)
找到一种解决方案(这种方法对我不起作用,往下看) https://blog.csdn.net/xuwukui/article/details/79042994
先执行一下两句安装命令(以ubuntu为例):
pip install pyvirtualdisplay
sudo apt-get install xvfb
然后添加如下代码:
from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 800))
display.start()
driver = webdriver.Chrome()
google到另外一种解决方案,完美解决 https://groups.google.com/forum/#!topic/qaf-users/ZRUbGWSL7Y8
You are using arg --headless so with that my be you can try with another argument --no-sandbox and window-size=1024,768.
chrome.additional.capabilities={"chromeOptions":{"args":["--headless", "window-size=1024,768", "--no-sandbox"], "binary": "/home/ubuntu/software/chromedriver"}}
You can refer following
https://stackoverflow.com/questions/22558077/unknown-error-chrome-failed-to-start-exited-abnormally-driver-info-chromedri
https://github.com/SeleniumHQ/selenium/issues/4961
按照上面给出的解决方案把代码修改如下:
chrome_options = Options()