用pip安装PyV8时遇到command 'cc' failed with exit status 1和'v8.h' file not found问题


指令:pip install PyV8,得到的错误提示如下。 (这已经不是我第一次遇到command 'cc' failed with exit status 1的问题了,一直不知道怎么觉得,系统为OS X 10.8,gcc版本为4.2)


 Downloading/unpacking PyV8
  Downloading PyV8-0.5.zip
  Running setup.py egg_info for package PyV8

Installing collected packages: PyV8
  Running setup.py install for PyV8
    building '_PyV8' extension
    cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DBOOST_PYTHON_STATIC_LIB -Ilib/python/inc -Ilib/boost/inc -Ilib/v8/inc -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/Exception.cpp -o build/temp.macosx-10.8-x86_64-2.7/src/Exception.o
    In file included from src/Exception.cpp:1:
    src/Exception.h:6:10: fatal error: 'v8.h' file not found
    #include <v8.h>
             ^
    1 error generated.
    error: command 'cc' failed with exit status 1
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools;__file__='/private/var/folders/wh/sv6f0t294_d1fr7l0sj7pn0m0000gn/T/pip-build-findingsea/PyV8/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/wh/sv6f0t294_d1fr7l0sj7pn0m0000gn/T/pip-M0KFjB-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_py

creating build

creating build/lib.macosx-10.8-x86_64-2.7

copying PyV8.py -> build/lib.macosx-10.8-x86_64-2.7

running build_ext

building '_PyV8' extension

creating build/temp.macosx-10.8-x86_64-2.7

creating build/temp.macosx-10.8-x86_64-2.7/src

cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DBOOST_PYTHON_STATIC_LIB -Ilib/python/inc -Ilib/boost/inc -Ilib/v8/inc -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/Exception.cpp -o build/temp.macosx-10.8-x86_64-2.7/src/Exception.o

In file included from src/Exception.cpp:1:

src/Exception.h:6:10: fatal error: 'v8.h' file not found

#include <v8.h>

         ^

1 error generated.

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/local/opt/python/bin/python2.7 -c "import setuptools;__file__='/private/var/folders/wh/sv6f0t294_d1fr7l0sj7pn0m0000gn/T/pip-build-findingsea/PyV8/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/wh/sv6f0t294_d1fr7l0sj7pn0m0000gn/T/pip-M0KFjB-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/wh/sv6f0t294_d1fr7l0sj7pn0m0000gn/T/pip-build-findingsea/PyV8
Storing complete log in /Users/findingsea/.pip/pip.log

尝试安装v8时又遇到了问题,安装指令:brew install v8,安装信息如下:


 ==> Downloading https://github.com/v8/v8/archive/3.19.18.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/v8-3.19.18.4.tar.gz
==> make dependencies
==> make native -j8 library=shared snapshot=on console=readline
GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. -S.native  -Dcomponent=shared_library -Dconsole=readline -Dv8_enable_backtrace=1 -Darm_fpu=default -Darm_float_abi=default
env: python: No such file or directory
make: *** [out/Makefile.native] Error 127

brew --config信息如下:


 HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 2f6dc2694b6af3b827617cfabf8230d6013b137d
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.4-x86_64
Xcode: 4.6.3
CLT: 4.6.0.0.1.1365549073
GCC-4.2: build 5666
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

gcc macosx

星熊YO仪 10 years, 8 months ago

缺少 v8 的头文件,因为没有安装 v8 或其开发文件。

yamada answered 10 years, 8 months ago

Your Answer