使用Python3安装lxml的问题(MacOS)

时间:2012-08-20 18:33:53

标签: python macos python-3.x lxml

尝试使用我的Python 3安装在Mountain Lion OSX计算机上安装lxml,按照此处的说明进行操作:http://lxml.de/build.html#building-lxml-on-macos-x

运行python3 setup.py build --static-deps后出现以下错误:

编辑:编辑了我收到的错误消息。只有尾随行,因为它很长。)

   ..
config.status: executing depfiles commands
config.status: executing libtool commands
rm: libtoolT: No such file or directory
make  all-recursive
Making all in libxslt
/bin/sh ../libtool --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../libxslt -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2 -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include    -g -O2 -Wall -c -o xsltutils.lo xsltutils.c
/bin/sh ../libtool --tag=CC   --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../libxslt -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2 -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include    -g -O2 -Wall -c -o security.lo security.c
libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../libxslt -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2 -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include -g -O2 -Wall -c xsltutils.c -o xsltutils.o
libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../libxslt -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2 -I/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include -g -O2 -Wall -c security.c -o security.o
xsltutils.c:1541:30: warning: incompatible pointer types passing 'xmlBufPtr'
      (aka 'struct _xmlBuf *') to parameter of type 'xmlBufferPtr' (aka
      'struct _xmlBuffer *') [-Wincompatible-pointer-types]
                xmlBufferWriteQuotedString(buf->buffer, result->version);
                                           ^~~~~~~~~~~
/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2/libxml/tree.h:1122:43: note: 
      passing argument to parameter 'buf' here
                xmlBufferWriteQuotedString(xmlBufferPtr buf,
                                                        ^
xsltutils.c:1554:30: warning: incompatible pointer types passing 'xmlBufPtr'
      (aka 'struct _xmlBuf *') to parameter of type 'xmlBufferPtr' (aka
      'struct _xmlBuffer *') [-Wincompatible-pointer-types]
                xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
                                           ^~~~~~~~~~~
/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2/libxml/tree.h:1122:43: note: 
      passing argument to parameter 'buf' here
                xmlBufferWriteQuotedString(xmlBufferPtr buf,
                                                        ^
xsltutils.c:1758:26: error: incomplete definition of type 'struct _xmlBuf'
        *doc_txt_len = buf->conv->use;
                       ~~~~~~~~~^
/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2/libxml/tree.h:104:16: note: 
      forward declaration of 'struct _xmlBuf'
typedef struct _xmlBuf xmlBuf;
               ^
xsltutils.c:1759:37: error: incomplete definition of type 'struct _xmlBuf'
        *doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len);
                                  ~~~~~~~~~^
/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2/libxml/tree.h:104:16: note: 
      forward declaration of 'struct _xmlBuf'
typedef struct _xmlBuf xmlBuf;
               ^
xsltutils.c:1761:28: error: incomplete definition of type 'struct _xmlBuf'
        *doc_txt_len = buf->buffer->use;
                       ~~~~~~~~~~~^
/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2/libxml/tree.h:104:16: note: 
      forward declaration of 'struct _xmlBuf'
typedef struct _xmlBuf xmlBuf;
               ^
xsltutils.c:1762:39: error: incomplete definition of type 'struct _xmlBuf'
        *doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len);
                                  ~~~~~~~~~~~^
/Users/Salem/Desktop/lxml-2.3.5/build/tmp/libxml2/include/libxml2/libxml/tree.h:104:16: note: 
      forward declaration of 'struct _xmlBuf'
typedef struct _xmlBuf xmlBuf;
               ^
2 warnings and 4 errors generated.
make[2]: *** [xsltutils.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 233, in <module>
    **setup_extra_options()
  File "setup.py", line 145, in setup_extra_options
    STATIC_CFLAGS, STATIC_BINARIES)
  File "/Users/Salem/Desktop/lxml-2.3.5/setupinfo.py", line 56, in ext_modules
    multicore=OPTION_MULTICORE)
  File "/Users/Salem/Desktop/lxml-2.3.5/buildlibxml.py", line 335, in build_libxml2xslt
    cmmi(libxslt_configure_cmd, libxslt_dir, multicore, **call_setup)
  File "/Users/Salem/Desktop/lxml-2.3.5/buildlibxml.py", line 266, in cmmi
    cwd=build_dir, **call_setup)
  File "/Users/Salem/Desktop/lxml-2.3.5/buildlibxml.py", line 249, in call_subprocess
    raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode))
Exception: Command "make -j5" returned code 512

1 个答案:

答案 0 :(得分:0)

您可以看到错误:checking whether the C compiler works... no

转到xcode并安装'命令行工具'

位于'Xcode / Preferences / Downloads'

如果您没有Xcode,请先从App Store获取。