Google V8/PyV8
Google V8 is Google’s open source JavaScript engine. V8 is written in C++ and is used in Google Chrome, the open source browser from Google. V8 implements ECMAScript as specified in ECMA-262, 3rd edition, and runs on Windows XP and Vista, Mac OS X 10.5 (Leopard), and Linux systems that use IA-32 or ARM processors. V8 can run standalone, or can be embedded into any C++ application.
PyV8 is a Python wrapper for the Google V8 engine. PyV8 acts as a bridge between the Python and JavaScript objects and supports the Google V8 engine in Python scripts.
In order to properly install Google V8 and PyV8 please follow the procedure described below.
-
$ git clone https://github.com/buffer/pyv8.git
-
$ cd pyv8
-
~/pyv8 $ python setup.py build
-
~/pyv8 $ sudo python setup.py install
如果遇到错误:
1:undefined symbol: PyUnicodeUCS4_FromEncodedObject
需要重新编译Python,编译时加上参数:--enable-unicode=ucs4,Python2.7的编译安装:略过
2:需要安排boost库支持
可以增加以下源到目录/etc/yum.repos.d下新建文件enetres.repo,详情可以参考:,此源提供PyV8 for CentOS的rpm包安装文件,不过是针对python2.6
-
参考:yum update boost-devel-1.59.0-1.x86_64 --setopt=protected_multilib=false
源内容如下:
-
[enetres]
-
name = ENETRES REPO for CentOS/RHEL $releasever
-
baseurl = http://repo.enetres.net/
-
enabled = 1
-
protect = 0
-
gpgcheck = 0
注:过程中可能会出现其它的依赖,请自行安装解决
安装完成后的测试情况:
阅读(3940) | 评论(0) | 转发(0) |