1. 程式人生 > >linux ubuntu 下安裝phantomjs

linux ubuntu 下安裝phantomjs

sudo apt install phantomjs 

 

phantomjs -v 報錯

 

在/usr/bin/phantomjs檔案適當位置加上下面兩行程式碼

  1. export QT_QPA_PLATFORM=offscreen
  2. export QT_QPA_FONTDIR=/usr/share/fonts

要跟著前面的那條“export

  1. #!/bin/sh
  2. LD_LIBRARY_PATH=”/usr/lib/phantomjs:$LD_LIBRARY_PATH”
  3. export LD_LIBRARY_PATH
  4. export QT_QPA_PLATFORM=offscreen
  5. export QT_QPA_FONTDIR=/usr/share/fonts
  6. exec “/usr/lib/phantomjs/phantomjs” “[email protected]