Importing PyV8 Engine into Python 2.7, the easy way

PyV8 is a Python wrapper module to perform JavaScript emulation on the fly like the way we do in SpiderMonkey. But, if you are having a hard-time configuring/compiling PyV8 sources then its always recommended to use the compiled binaries. If you are able to compile the V8 sources successfully without any errors then you don’t have to follow the below steps. The below steps are for those who were unable to import the PyV8 module into their Python interactive console. Please follow the below steps accordingly.

Generally below is the location where the Python v2.x modules are stored:


You can fetch the list of PyV8 sources from the below URL:

Download the appropriate package which suits your OS flavor. Extract the files into your desktop and copy both the files i..e “” and “” to the location from where Python looks for the presence of modules. You can follow the the below steps if it was confusing at the first place.

$ cd ~/tmp/
$ wget -c ""
$ unzip
$ sudo cp *PyV8* /usr/lib/python2.7/dist-packages/

Afterwards to verify if you can import the wrapper module successfully, fire your Python console and import PyV8 Module. If you are able to see the output like below then you are all set!

    [email protected]:~$ python
    Python 2.7.6 (default, Apr 10 2015, 08:20:38) 
    [GCC 4.8.2] on linux2
    >>> import PyV8
    >>> dir(PyV8)
    ['AST', 'DontDelete', 'DontEnum', 'HAS_UTF8', 'Internal', 'JSAllocationAction', 'JSArray', 'JSAttribute', 'JSClass', 'JSClassConstructor', 'JSClassPrototype', 'JSContext', 'JSDebugEvent', 'JSDebugProtocol', 'JSDebugger', 'JSEngine', 'JSError', 'JSExtension', 'JSFunction', 'JSIsolate', 'JSLocker', 'JSObject', 'JSObjectSpace', 'JSProfiler', 'JSScript', 'JSStackFrame', 'JSStackTrace', 'JSUnlocker', 'JS_ESCAPABLE', 'MAXYEAR', 'MINYEAR', 'ReadOnly', 'StringIO', 'TestAST', 'TestContext', 'TestDebug', 'TestEngine', 'TestMultithread', 'TestProfile', 'TestWrapper', '_PyV8', '__all__', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__version__', '_js_escape_unicode_re_callack', 'collections', 'convert', 'date', 'datetime', 'datetime_CAPI', 'func_apply', 'is_py3k', 'js_escape_unicode', 'json', 'logging', 'os', 'print_function', 'profiler', 're', 'sys', 'thread', 'time', 'timedelta', 'toNativeString', 'toUnicodeString', 'traceback', 'tzinfo', 'unittest', 'with_statement']