ROS中的软件包安装在MacOS上失败

时间:2018-05-08 08:58:44

标签: r tidyverse quantmod

我尝试在R Studio中安装两个软件包:tidyverse和quantmod。然而,两者都给我错误,我无法理解为什么(谷歌搜索没有帮助理解问题)。

对于整洁的经文,我得到:

> install.packages("tidyverse")
also installing the dependency ‘xml2’


  There are binary versions available but the source versions are later:
          binary source needs_compilation
xml2       1.1.1  1.2.0              TRUE
tidyverse  1.1.1  1.2.1             FALSE

Do you want to install from sources the package which needs compilation?
y/n: y
installing the source packages ‘xml2’, ‘tidyverse’

trying URL 'https://cran.rstudio.com/src/contrib/xml2_1.2.0.tar.gz'
Content type 'application/x-gzip' length 251614 bytes (245 KB)
==================================================
downloaded 245 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/libxml2
Using PKG_LIBS=-L/usr/lib -lxml2 -lz -lpthread -licucore -lm
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘xml2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘tidyverse’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/rs/dj94tlfj263dzp30z6kvqb5m0000gn/T/RtmpH2BAQU/downloaded_packages’

对于quantmod,我也有两个错误:

make: gfortran-4.8: No such file or directory
make: *** [period.max.o] Error 1
ERROR: compilation failed for package ‘xts’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/xts’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/xts’

make: gfortran-4.8: No such file or directory
make: *** [movingAverages.o] Error 1
ERROR: compilation failed for package ‘TTR’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/TTR’
Warning in install.packages :
  installation of package ‘TTR’ had non-zero exit status
ERROR: dependency ‘TTR’ is not available for package ‘quantmod’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/quantmod’

我认为这可能与我的道路有关,但我没有足够的经验让它发挥作用。

2 个答案:

答案 0 :(得分:0)

通过卸载我通过Homebrew安装的所有R版本来解决这个问题:

JSON.stringify(['Boxer', 'Terrier']) === JSON.stringify(['Boxer', 'Terrier']);

然后从CRAN here重新安装。

答案 1 :(得分:0)

我遇到了同样的问题。 我终于通过参考here

解决了这个问题

首先,按照libxml2 web的说明手动安装lxml2,但是在安装时出现错误:

...
mkdir: /usr/include: Operation not permitted
...

然后将前缀更改为:

./configure --prefix=/usr/local --disable-static --with-history && make
sudo make install

然后再次安装R包“ xml2”,确定。