【问题标题】:Issues with installing lxml with Python3 (MacOS)使用 Python3 (MacOS) 安装 lxml 的问题
【发布时间】:2012-08-16 02:31:14
【问题描述】:

一直在尝试在 Mountain Lion OSX 机器上安装我的 Python 3 安装 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

【问题讨论】:

    标签: python macos python-3.x lxml


    【解决方案1】:

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

    转到 xcode 并安装“命令行工具”

    它位于“Xcode/Preferences/Downloads”下

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

    【讨论】:

    • 首选项/下载屏幕显示命令行工具已安装。
    • 我已经重新启动了终端,但现在出现了另一个错误。我会将其添加到问题中。
    • 什么版本的 Xcode?我认为它正在尝试使用 gcc 进行编译——到目前为止,山狮还没有成功。你试过mac端口吗?或者安装更高版本的 xcode 和新的命令行工具。
    • 版本为 4.4.1。我也有macports,并通过它下载了apple-gcc40..
    • gcc 是问题所在。你需要使用clang。
    猜你喜欢
    • 2017-01-04
    • 2019-11-13
    • 1970-01-01
    • 2016-12-13
    • 2019-04-15
    • 2011-12-16
    • 1970-01-01
    • 1970-01-01
    • 2018-11-26
    相关资源
    最近更新 更多