2016-07-12 28 views
5

Selenyum ve bir phantomjs webdriver kullanan bir linux sunucusunda bir python betiği çalıştırmaya çalışıyorum; yolda dosyayı çağıranpython ve selenum kullanarak phantomJs webdriver'e bağlanmada sorun

import selenium 
from selenium import webdriver 

driver = webdriver.PhantomJS(executable_path='/home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs') 

döndürür: Burada

selenium.common.exceptions.WebDriverException: Message: Service /home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs unexpectedly exited. Status code was: 127 

başarısız olur ve bu hatayı oluşturur basit bir test script: ancak, aşağıdaki hata iletisi almaya devam

file /home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs 
/home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=d0f2a21ff9e0b82113a2095e7cbca7dceaba88fb, stripped 

Bu komut dosyasını nasıl çalıştırabileceğimi bilen herhangi bir fikri olan var mı? Benzer stackoverflow soruları gibi görünenleri okudum ve phantom'u npm ile yeniden yükleme ve betiği sudo ile yürütme gibi önerilen çözümleri uygulama girişiminde bulundum, ancak şansım olmadı. Daha fazla bilgi sağlayabilirsem lütfen bana bildirin.

cevap

20
sudo apt-get install libfontconfig 

Bu, sorunumu çözdü.