Ubuntu 下安装phantomjs

1、下载安装包

wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

  

2、解压

tar -xvf phantomjs-2.1.1-linux-x86_64.tar.bz2

  

3、将文件移到/usr/local/目录下

mv /usr/local/src/phantomjs-1.9.7-linux-x86_64 /usr/local/phantomjs

  

4、软链接

ln -s /usr/local/phantomjs/bin/phantomjs /usr/local/bin/

  

可能会碰到这个报错:

phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

  这个需要安装libfontconfig1库

apt-get install libfontconfig1

  

原文地址:https://www.cnblogs.com/gentlemanwuyu/p/11413072.html