Easy_install无法在Mac上安装带有gcc 4.2.1的lxml

时间:2016-04-04 01:57:08

标签: macos gcc lxml easy-install

我正在尝试在我的mac(OSX Yosemite 10.10.5)上安装lxml以与BeautifulSoup一起使用。

easy_install lxml

然而,它无法运行,看起来像是在搜索错误版本的gcc:

unable to execute gcc-4.0: No such file or directory
Compile failed: command 'gcc-4.0' failed with exit status 1 /var/folders/zt/hvzclr2s00scp1ppzyr2j6k40000gn/T/easy_install-yDugbm/lxml-3.6.0/temp/xmlXPathInitV0OYZj.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main (int argc, char **argv) {
^
1 warning generated.
ld: library not found for -lgcc_s.10.5

基于类似的问题我已尝试过:

  • 正在运行xcode-select --install并且当前拥有gcc 4.2.1版
  • 将特定的gcc版本链接到/ usr / bin / gcc。 sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.0。 4.0链接解决了这个问题,但是发出了许多与sytanx相关的错误(error: Unsupported architectureerror: unknown type name '__int64_t'等),这并不令人惊讶,因为它是一个不同的版本。

根据要求,以下是带有gcc-4.0别名的easy_install lxml的输出:

Searching for lxml
Reading https://pypi.python.org/simple/lxml/
Best match: lxml 3.6.0
Downloading https://pypi.python.org/packages/source/l/lxml/lxml-3.6.0.tar.gz#md5=5957cc384bd6e83934be35c057ec03b6
Processing lxml-3.6.0.tar.gz
Writing /var/folders/zt/hvzclr2s00scp1ppzyr2j6k40000gn/T/easy_install-R7v3TQ/lxml-3.6.0/setup.cfg
Running lxml-3.6.0/setup.py -q bdist_egg --dist-dir /var/folders/zt/hvzclr2s00scp1ppzyr2j6k40000gn/T/easy_install-R7v3TQ/lxml-3.6.0/egg-dist-tmp-u8jVqK
Building lxml version 3.6.0.
Building without Cython.
Using build configuration of libxslt 1.1.28
Building against libxml2/libxslt in the following directory: /opt/local/lib
In file included from src/lxml/lxml.etree.c:82:
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include/limits.h:37:
In file included from /usr/include/limits.h:63:
/usr/include/sys/cdefs.h:680:2: error: Unsupported architecture
#error Unsupported architecture
 ^
In file included from src/lxml/lxml.etree.c:82:
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include/limits.h:37:
In file included from /usr/include/limits.h:64:
/usr/include/machine/limits.h:8:2: error: architecture not supported
#error architecture not supported
 ^
In file included from src/lxml/lxml.etree.c:82:
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:
In file included from /usr/include/stdio.h:67:
In file included from /usr/include/_types.h:27:
In file included from /usr/include/sys/_types.h:33:
/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
 ^
In file included from src/lxml/lxml.etree.c:82:
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:
In file included from /usr/include/stdio.h:67:
In file included from /usr/include/_types.h:27:
/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
        ^
/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
        ^
/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_dev_t;         /* dev_t */
        ^
/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
        ^
/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
        ^
/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'
typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
        ^
/usr/include/sys/_types.h:66:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_ino_t;         /* [???] Used for inodes */
        ^
/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
        ^
/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'
typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
        ^
/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
        ^
/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
        ^
/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
        ^
/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
        ^
/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
        ^
/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
        ^
In file included from src/lxml/lxml.etree.c:82:
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:
In file included from /usr/include/stdio.h:71:
/usr/include/sys/_types/_va_list.h:31:9: error: unknown type name '__darwin_va_list'; did you mean '__builtin_va_list'?
typedef __darwin_va_list va_list;
        ^
note: '__builtin_va_list' declared here
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Compile failed: command 'gcc-4.0' failed with exit status 1
/var/folders/zt/hvzclr2s00scp1ppzyr2j6k40000gn/T/easy_install-R7v3TQ/lxml-3.6.0/temp/xmlXPathInitr479pk.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main (int argc, char **argv) {
^
1 warning generated.
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select --install
*********************************************************************************
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

这是运行pip install --upgrade pip的输出: (更新:通过将Python升级到2.7.11版来解决。版本必须为2.7.9或更高版本)

  

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/ 供应商/请求/包/ urllib3 /util/ssl.py:315:   SNIMissingWarning:已经发出了HTTPS请求,但是SNI   (主题名称指示)此处不提供TLS扩展名   平台。这可能导致服务器出现错误的TLS   证书,可能导致验证失败。更多   信息,见   https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning。   SNIMissingWarning   /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/vendor/requests/packages/urllib3/util/ SSL 的.py:120:   InsecurePlatformWarning:真正的SSLContext对象不可用。   这可以防止urllib3适当地配置SSL并可能导致   某些SSL连接失败。有关更多信息,请参阅   https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning。   InsecurePlatformWarning无法获取URL   https://pypi.python.org/simple/pip/:确认有问题   ssl证书:[Errno 1] _ssl.c:499:错误:0D0890A1:asn1   编码例程:ASN1_verify:未知消息摘要算法 -   跳过要求已经是最新的:pip in   /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg   /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg/pip/vendor/requests/packages/urllib3/util/ SSL 的.py:120:   InsecurePlatformWarning:真正的SSLContext对象不可用。   这可以防止urllib3适当地配置SSL并可能导致   某些SSL连接失败。有关更多信息,请参阅   https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning。   InsecurePlatformWarning

如何正确配置/使用我的easy_install?

0 个答案:

没有答案