R 版本 3.6.1 中的 tm 包安装错误 (2019-07-05) -- "Action of the Toes"



我正在尝试在macOS High Sierra 10.13.6版本下运行的Macbook Pro(2011年末(上使用R中的tm包。tm包已经安装,但当我加载它时,我收到以下错误消息

Error: package or namespace load failed for ‘tm’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘slam’

然后我试着安装slam,得到了这个:


There is a binary version available but the source
version is later:
binary source needs_compilation
slam 0.1-45 0.1-46              TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) y
installing the source package ‘slam’
trying URL 'https://cran.rstudio.com/src/contrib/slam_0.1-46.tar.gz'
Content type 'application/x-gzip' length 53515 bytes (52 KB)
==================================================
downloaded 52 KB
* installing *source* package ‘slam’ ...
** package ‘slam’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c apply.c -o apply.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c dll.c -o dll.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c grouped.c -o grouped.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c sparse.c -o sparse.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c util.c -o util.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o slam.so apply.o dll.o grouped.o sparse.o util.o -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [slam.so] Error 1
ERROR: compilation failed for package ‘slam’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/slam’
Warning in install.packages :
installation of package ‘slam’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/zq/lzsw_rp15sj3wtfvb3r0kksc0000gn/T/RtmpX95gez/downloaded_packages’```
Can anyone please help me fix this?
Thanks!

我今天遇到了完全相同的问题。我在Mac Book Pro上使用macOS Mojave(10.14.6(运行R 3.6.1(和你一样(,我收到了同样的错误消息。

我在这里尝试了一些答案:安装TM包时依赖项"slam"不可用

通过尝试:

install.packages("NLP", dependencies = TRUE)
install.packages("tm", dependencies = TRUE)

但没有快乐。

所以我去了这里:https://cran.r-project.org/web/packages/slam/index.html并将slam_0.1-45.tgz下载到我的下载文件夹然后直接从那里安装,使用:

install.packages("~/Downloads/slam_0.1-45.tgz", repos = NULL, type = .Platform$pkgType)

现在似乎可以很好地安装tm软件包了。

相关内容

最新更新