我已经使用自制软件构建了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
答案 0 :(得分:2)
尝试使用:
CFLAGS="-O0" sudo pip install lxml
希望这会好起来!