phantomjs安装

1, python setuptools

2, python: argparse: http://code.google.com/p/argparse/ 

 

phantomjs依赖:

1) python >=2.6

2), PyQt4 >= 4.8.0  PyQt4的一个学习文档: http://www.cnblogs.com/coderzh/archive/2009/06/28/1512654.html 

3), Qt >= 4.7

 

其中:

PyQt4 依赖: sip

sip 简介:  http://www.riverbankcomputing.co.uk/static/Docs/sip4/introduction.html 

SIP is a tool for automatically generating Python bindings for C and C++ libraries. SIP was originally developed in 1998 for PyQt - the Python bindings for the Qt GUI toolkit - but is suitable for generating bindings for any C or C++ library.

下载: http://www.riverbankcomputing.co.uk/software/sip/download 

安装:

pyhton configure.py

make; make install; 

http://bluehua.org/tag/pyqt4

http://code.google.com/p/phantomjs/wiki/XvfbSetup


安装QT:

http://doc.qt.nokia.com/4.7/install-x11.html 

 

安装PyQt:

安装phantomjs

phantomjs 需要 Xvbf.  这个需要root来安装. 

yum install xorg-x11-server-Xvfb xorg-x11-server-Xorg xorg-x11-fonts*

 

 

运行Xvbf: Xvfb :0 -screen 0 1024x768x24 2>/dev/null &

这是可能会报错: 先别管. 看进程是否启动. 

 

注意:Xvfb :0  , 则运行时要加上: DISPLAY=:0 pyphantomjs hello.js 

hello.js 可以很简单:

console.log('Hello, world!');
phantom.exit();

 

运行:

DISPLAY=:0 pyphantomjs hello.js 

 

即可查看结果了.. 


你可能感兴趣的:(ant)