今天安裝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
前幾天是新手的時候枣申,遇到報錯一般是哭天喊地糊治,現(xiàn)在冷靜多了萍聊,開始解決:
其實一般R語言都會給出提示:
先安裝這倆:
$ sudo apt-get install libxml2
$ sudo apt-get install libxml2-dev
解決不了問題吨掌,懷疑是pkg-config沒找到libxml-2.0.pc:
pkg-config可用與列舉出某個庫的相關(guān)信息惫撰,比如此庫的路徑然眼、相關(guān)頭文件路徑等
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后甘邀,指定環(huán)境變量 解決辦法: 確定 /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
http://www.reibang.com/p/3f995b73eafa
https://blog.csdn.net/f_hawk189/article/details/80681972