R:安装包时出现问题(与目录名中的空格有关?) [英] R: Problems installing package (related to space in directory name?)
问题描述
我正在尝试安装 CausalImpact 包,但由于对 bsts 的依赖而失败.
I'm trying to install the CausalImpact package and failing due to a dependency on bsts.
我尝试安装 bsts 没有成功,查看结果我发现我认为对 Boom 的依赖失败了:
I've tried to install bsts without success, and looking at the results I see what I think is a failure on a dependency for Boom:
install.packages("bsts", lib="C:/R/win-library/3.3")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘bsts’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘bsts’
trying URL 'https://cran.rstudio.com/src/contrib/bsts_0.6.3.tar.gz'
Content type 'application/x-gzip' length 148815 bytes (145 KB)
downloaded 145 KB
* installing *source* package 'bsts' ...
** package 'bsts' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/g++ -std=c++0x -I"C:/PROGRA~1/R/R-33~1.0/include" -DNDEBUG -I`C:/PROGRA~1/R/R-33~1.0/bin/Rscript -e "cat(system.file(package='Boom'))"`/include -DNO_BOOST_THREADS -DNO_BOOST_FILESYSTEM -DADD_ -DR_NO_REMAP -DRLANGUAGE -I"C:/Users/Firstname Lastname/Documents/R/win-library/3.3/Boom/include" -I"C:/Users/Firstname Lastname/Documents/R/win-library/3.3/BH/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c aggregate_time_series.cc -o aggregate_time_series.o
g++.exe: error: Lastname/Documents/R/win-library/3.3/Boom/include: No such file or directory
我认为 g++ 变得不高兴了,因为 R 已将该库放在 C:Users/Firstname Lastname 的子文件夹中,并且它不喜欢我名字中的空格.
What I assume is that g++ is getting upset because R has put the library in a subfolder of C:Users/Firstname Lastname, and it's not liking the space in my name.
我尝试将 R_LIBS_USER 环境变量设置为 C:/R/win-library/3.3 以通过路径中的空格消除此问题,但没有成功 - 即使在完全重新启动计算机后,错误仍然重复 -它仍然会转到 C:/Users/Firstname Lastname/Documents/R/win-library/3.3 目录.
I tried setting the R_LIBS_USER environment variable to C:/R/win-library/3.3 to eliminate this problem with a space in the path, but with no success - even after a full restart of the computer, the error repeats - it's still going to the C:/Users/Firstname Lastname/Documents/R/win-library/3.3 directory.
我在 Windows 10 上使用 RStudio 0.99.896 和 R 3.3.0,如果这有什么不同的话
I'm using RStudio 0.99.896 with R 3.3.0 on Windows 10, if that makes any difference
推荐答案
如本相关问题如果您不一定需要最新版本的bsts
,您仍然可以在Windows 上安装0.6.2 版,这样您就可以安装CausalImpact
:
As suggested in this related question if you don't necessarily need the latest version of bsts
you can still install version 0.6.2 on Windows, and that will let you install CausalImpact
:
install.packages("https://cran.r-project.org/bin/windows/contrib/3.2/bsts_0.6.2.zip",
repos = NULL, type = "local")
library(devtools)
devtools::install_github("google/CausalImpact")
适用于 Win 10, R 3.3.0
works on Win 10, R 3.3.0
这篇关于R:安装包时出现问题(与目录名中的空格有关?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!