odoo安装依赖问题 作者: jlb 2020年04月03日 [TOC] # 安装lxml问题: 问题: ``` In file included from src/lxml/lxml.etree.c:515:0: src/lxml/includes/etree_defs.h:14:10: fatal error: libxml/xmlversion.h: 没有那个文件或目录 #include "libxml/xmlversion.h" ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 1 creating tmp cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitbcfnfalq.c -o tmp/xmlXPathInitbcfnfalq.o /tmp/xmlXPathInitbcfnfalq.c:1:10: fatal error: libxml/xpath.h: 没有那个文件或目录 #include "libxml/xpath.h" ^~~~~~~~~~~~~~~~ compilation terminated. ********************************************************************************* Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? ********************************************************************************* error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for lxml Running setup.py clean for lxml ``` 注意存在 > ********************************************************************************* Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? ********************************************************************************* 解决办法安装依赖: ``` sudo apt-get install libxml2-dev libxslt1-dev ``` 再次安装还有其他错误: ``` ERROR: b'/bin/sh: 1: xslt-config: not found\n' ** make sure the development packages of libxml2 and libxslt are installed ** ``` 查了一下,这是python-dev中提供的一个头文件,所以需要安装python-dev(我用的是Python3,所以装了python3-dev)。用apt安装一下,然后再用pip install lxml,没想到依旧报错不能安装orz。这次错误换了一个 ``` /usr/bin/ld: cannot find -lz ``` stackoverflow上对于这个问题提供的方法是安装zlib1g-dev,用apt-get安装后,再次尝试编装lxml,终于编译安装成功。 实际上用一条命令吧所需的几个dev包装上就能搞定了。 ``` sudo apt-get install python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev ``` 后来发现Stackoverflow上的已经有人问了这个问题。[Stackoverflow](https://stackoverflow.com/questions/5178416/libxml-install-error-using-pip "Stackoverflow链接") # 安装python-ldap问题 问题: ```inux-x86_64-3.6/Modules/LDAPObject.o Modules/LDAPObject.c:16:10: fatal error: sasl/sasl.h: 没有那个文件或目录 #include <sasl/sasl.h> ^~~~~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for python-ldap ``` 还是缺少依赖 解决办法: ``` sudo apt-get install libsasl2-dev ``` # 总结 安装第三方包过程中有`xml`和`python-ldap`两个包需要分别安装额外的应用: ``` sudo apt-get install python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev sudo apt-get install libsasl2-dev ```