简体   繁体   中英

Issues with installing lxml with Python3 (MacOS)

Been trying to install lxml with my Python 3 installation on a Mountain Lion OSX machine, following the instructions here: http://lxml.de/build.html#building-lxml-on-macos-x

I get the following error after running python3 setup.py build --static-deps :

( Edit : edited the error message I'm getting. Only the trailing lines are below as it is quite long.)

   ..
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

You can see the error: checking whether the C compiler works... no

Go to xcode and install 'command line tools'

It is under 'Xcode / Preferences / Downloads'

If you do not have Xcode, get that first from the App Store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM