Mac安装ujson、scrapy、cchardet
程序员文章站
2022-05-07 13:01:15
...
最近在装爬虫,发现部分模块总是无法顺利安装,问题是同一个
/usr/local/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/twisted/test/raiser.c -o build/temp.macosx-10.6-intel-3.6/src/twisted/test/raiser.o
/usr/local/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.6/src/twisted/test/raiser.o -o build/lib.macosx-10.6-intel-3.6/twisted/test/raiser.cpython-36m-darwin.so
ld: in '/usr/local/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libunwind.dylib for architecture i386
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/local/bin/clang' failed with exit status 1
这里是关键:
'/usr/local/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libunwind.dylib for architecture i386
出现这种情况的直接原因是,libunwind.dylib是64位的,而其他需要链接的模块是32位的。一般来说,根本的原因是因为在安装某些开发环境的时候,意外导致了库的版本不匹配。
我们可以通过查询该库的地址来发现真凶:
ls -l /usr/local/lib/libunwind.dylib
lrwxr-xr-x 1 lex admin 42 5 3 16:20 /usr/local/lib/libunwind.dylib -> ../Cellar/[email protected]4/4.0.1/lib/libunwind.dylib
可以看到,这个文件把link到了llvm上,我可能不知道是装什么东西的装了这个llvm。而这个llvm的 libunwind.dylib 意外导致了我的python无法安装大量的模块。通过brew uninstall卸载llvm。问题解决!
上一篇: mac上安装scrapy框架
下一篇: MAC下安装scrapy