2016-07-05 77 views
4

我想運行一個使用硒模塊的python代碼。這段代碼在我的電腦中使用了一個chromedriver完美運行。我試圖在c9.io中運行它。我下載了chromedriver 64位版本,並使用chmod將權限設置爲777。我仍然無法得到它的工作在c9中運行硒

不過,我得到以下錯誤:

Traceback (most recent call last): 
    File "/home/ubuntu/workspace/vroniplag/vroni.py", line 119, in <module> 
    op('Aaf') 
    File "/home/ubuntu/workspace/vroniplag/vroni.py", line 104, in op 
    plags=getplags(cd) 
    File "/home/ubuntu/workspace/vroniplag/vroni.py", line 92, in getplags 
    driver = webdriver.Chrome(chromedriver) 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__ 
    self.service.start() 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 86, in start 
    self.assert_process_still_running() 
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 99, in assert_process_still_running 
    % (self.path, return_code) 
selenium.common.exceptions.WebDriverException: Message: Service ./chromedriver unexpectedly exited. Status code was: 127 

任何人能告訴我如何解決這個

回答

6

我遇到了同樣的問題,並運行chromedriver --version給了我確切的錯誤。

chromedriver: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

所以對我來說,問題是缺少的庫(該chromedriver需要)。所以我安裝了這些庫和固定的問題:

sudo yum install libX11 Gconf2 fontconfig 
+3

這讓我在右邊跟蹤(Ubuntu 64位) - 缺少libgconf。 –

+0

我仍然有這個問題與Ubuntu ... 當我做chromedriver - 版本時,我得到錯誤,同時加載共享庫:libnss3.so:無法打開共享對象文件:沒有這樣的文件或目錄' – Krishnakumar

+0

@AmichaiSchreiber /託尼Vu:建議,可能會有所幫助..謝謝 – Krishnakumar

0

我有同樣的問題,但它是與32位版本。修復它使用64位版本。

+2

可能提供更多的細節將幫助.... – baranskistad

3

我解決了這個在Ubuntu 16.04以下幾點:

$ sudo apt install libgconf-2-4 
+0

我用這個解決方案successed當我遇到「消息:服務chromedriver意外退出狀態碼爲:127「。但是,這如何工作? – Beomi

+0

你好,我仍然有這個問題..儘管有libgconf-2-4 .. – Krishnakumar

+0

當我做chromedriver - 版本時,我得到 錯誤,當加載共享庫時:libnss3.so:無法打開共享對象文件:沒有這樣的文件或目錄' – Krishnakumar