【问题标题】:Mac OS X (10.12.6) with Python 3.7.0a install lxml failed带有 Python 3.7.0a 的 Mac OS X (10.12.6) 安装 lxml 失败
【发布时间】:2018-04-21 06:48:42
【问题描述】:

我已经用自制软件构建了 libxslt(1.1.31) 和 libxml2(2.9.7) 并建立了链接

brew install libxml2
Warning: libxml2 2.9.7 is already installed
brew install libxslt
Warning: libxslt 1.1.31 is already installed

已安装 Xcode 并尝试重新安装命令行工具

xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

导出的 C_INCLUDE_PATH

echo $C_INCLUDE_PATH

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/

试过这个:

STATIC_DEPS=true pip install lxml

尝试了 easy_install 并尝试从源代码构建它。

但是,所有方法都失败了。这真的让我很困惑。

错误信息是:

/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DCYTHON_CLINE_IN_TRACEBACK=1 -I/usr/local/Cellar/libxslt/1.1.31/include -I/usr/local/Cellar/libxml2/2.9.7/include/libxml2 -Isrc -Isrc/lxml/includes -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/lxml/etree.c -o build/temp.macosx-10.6-intel-3.7/src/lxml/etree.o -w -flat_namespace


  src/lxml/etree.c:243289:21: error: no member named 'exc_state' in 'struct _ts'
      *type = tstate->exc_state.exc_type;
              ~~~~~~  ^
  src/lxml/etree.c:243290:22: error: no member named 'exc_state' in 'struct _ts'
      *value = tstate->exc_state.exc_value;
               ~~~~~~  ^
  [...(same error omitted)]
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  Compile failed: command '/usr/bin/clang' failed with exit status 1


  creating var
  creating var/folders
  creating var/folders/5m
  creating var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn
  creating var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T
  cc -I/usr/local/Cellar/libxslt/1.1.31/include -I/usr/local/Cellar/libxml2/2.9.7/include/libxml2 -I/usr/include/libxml2 -c /var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.c -o var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.o
  /var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
  main (int argc, char **argv) {
  ^
  1 warning generated.
  cc var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.o -L/usr/local/Cellar/libxslt/1.1.31/lib -L/usr/local/Cellar/libxml2/2.9.6/lib -lxml2 -o a.out
  ld: warning: directory not found for option '-L/usr/local/Cellar/libxml2/2.9.6/lib'
  error: command '/usr/bin/clang' failed with exit status 1
  Failed building wheel for lxml

【问题讨论】:

    标签: macos python-3.x lxml


    【解决方案1】:

    尝试使用: CFLAGS="-O0" sudo pip install lxml

    希望这一切顺利!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-10
      • 1970-01-01
      • 1970-01-01
      • 2015-08-05
      • 2013-11-02
      • 2018-05-03
      • 2015-05-23
      相关资源
      最近更新 更多