ubuntu(centos)下golang下载libxml2 报错信息, go 安装libxml2

ubuntu下golang下载libxml2 报错信息:
$ go get -u github.com/lestrrat-go/libxml2                     
# pkg-config --cflags -- libxml-2.0 Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc' to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found pkg-config: exit status 1 ​ ​

 
因为系统少了个libxml2 开发包:

使用以下命令即可修复:
sudo apt install libxml2-dev
 
 
如果是centos的话,安装命令:
yum install libxml2
yum install libxml2-devel

注意是 libxml2-devel !
别用那种下载源码编译的方法,能用yum就用yum,否则弄得系统一堆依赖问题。

0 个评论

要回复文章请先登录注册