今天安装R包tm时遇到报错:
ERROR: dependency ‘xml2’ is not available for package ‘tm’
于是安装xml2,又遇到报错
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 variableNo package 'libxml-2.0' found
前几天是新手的时候,遇到报错一般是哭天喊地,现在冷静多了,开始解决:
其实一般R语言都会给出提示:
先安装这俩:
$ sudo apt-get install libxml2
$ sudo apt-get install libxml2-dev
解决不了问题,怀疑是pkg-config没找到libxml-2.0.pc:
pkg-config可用与列举出某个库的相关信息,比如此库的路径、相关头文件路径等
checking for LIBXML2... no configure: error: Package requirements (libxml-2.0 >= 2.6.0) were not met: No package 'libxml-2.0' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBXML2_CFLAGS and LIBXML2_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. 手动安装libxml2后,指定环境变量 解决办法: 确定 /usr/local/libxml2/lib/pkgconfig 目录下有 libxml-2.0.pc export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
参考:
https://blog.csdn.net/bryce_xiao/article/details/70787810
https://www.jianshu.com/p/3f995b73eafa
https://blog.csdn.net/f_hawk189/article/details/80681972
网友评论