1. 程式人生 > >CentOS7系統 Python3虛擬環境下 PyV8的安裝與使用

CentOS7系統 Python3虛擬環境下 PyV8的安裝與使用

系統:centos7  

環境:python3.6.3

 1 、安裝boost  :  PyV8 依賴於Boost

yum install boost
yum install boost-devel
yum install boost-doc

2 、下載pyv8檔案

 github 地址: https://github.com/emmetio/pyv8-binaries

 將PyV8.py以及_PyV8.so上傳到 python 的 site-packages目錄下 即可

 注意: 你下載的包裡 。檔案是這樣的: 

需要把 _PyV8.cpython-33m.so  重新命名為 : _PyV8.so

(py3) [[email protected] site-packages]# unzip pyv8-linux64-p3.zip 
Archive:  pyv8-linux64-p3.zip
  inflating: _PyV8.cpython-33m.so    
  inflating: PyV8.py                 
(py3) [[email protected] site-packages]# rm -rf pyv8-linux64-p3.zip 
(py3) [
[email protected]
site-packages]# mv _PyV8.cpython-33m.so _PyV8.so (py3) [[email protected] site-packages]# ls

3 測試 :

(py3) [[email protected] site-packages]# python
Python 3.6.3 (default, Oct  8 2018, 10:37:35) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyV8
>>> 

不報錯。即成功

 

參考博文:https://www.cnblogs.com/richerdyoung/p/8535149.html