首页 > 解决方案 > 即使在 Rstudio 中安装包后,Data.table 包也无法正常工作。如何修复?

问题描述

> install.packages("data.table")

  There is a binary version available but the source version is later:
           binary source needs_compilation
data.table 1.13.6 1.14.0              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) 
installing the source package ‘data.table’

trying URL 'https://cran.rstudio.com/src/contrib/data.table_1.14.0.tar.gz'
Content type 'application/x-gzip' length 5303849 bytes (5.1 MB)
==================================================
downloaded 5.1 MB

* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** using staged installation
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
*** pkg-config is not installed.
*** Compilation will now be attempted and if it works you can ignore this message. In
*** particular, this should be the case on Mac where zlib is built in or pkg-config
*** is not installed. However, if compilation fails, try 'locate zlib.h zconf.h' and
*** ensure the zlib development library is installed :
***   deb: zlib1g-dev (Debian, Ubuntu, ...)
***   rpm: zlib-devel (Fedora, EPEL, ...)
***   There is a zlib in brew for OSX but the built in zlib should work.
*** Note that zlib is required to compile R itself so you may find the advice in the R-admin
*** guide helpful regarding zlib. On Debian/Ubuntu, zlib1g-dev is a dependency of r-base as
*** shown by 'apt-cache showsrc r-base | grep ^Build-Depends | grep zlib', and therefore
*** 'sudo apt-get build-dep r-base' should be sufficient too.
*** To silence this message, please ensure that :
***   1) 'pkg-config --exists zlib' succeeds (i.e. $? -eq 0)
***   2) 'pkg-config --libs zlib' contains -lz
*** Compilation will now be attempted ...
./configure: line 91: -fopenmp: command not found
*** OpenMP not supported! data.table uses OpenMP to automatically
***   parallelize operations like sorting, grouping, file reading, etc.
*** For details on how to install the necessary toolchains on your OS see:
***   https://github.com/Rdatatable/data.table/wiki/Installation
*** Continuing installation without OpenMP support...
*** Compilation without compression support in fwrite
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘data.table’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/data.table’
Warning in install.packages :
  installation of package ‘data.table’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/pn/3jvffq0x5yx28m8rhbgwp0n80000gn/T/RtmpB2XTYQ/downloaded_packages’
> library(data.table)
Error in library(data.table) : there is no package called ‘data.table’

标签: rdata.tabler-package

解决方案


推荐阅读