我想安装 processx 库,因为它是我正在使用的 BioConductor 包的必需包。使用 install.packages("processx") 时出现以下错误
data(mtcars)
cars1 <- mtcars
cars2 <- mtcars
library(RODBC)
db <- odbcConnectAccess2007(db_file_path)
sqlSave(db, cars1, tablename = "MTCARS 1", fast = TRUE, safer = FALSE, rownames = FALSE, colnames = FALSE)
sqlSave(db, cars2, tablename = "MTCARS 2", fast = TRUE, safer = FALSE, rownames = FALSE, colnames = FALSE)
odbcClose(db)
我提到了 this post which provides a solution via the withr library。当我使用安装集群库时遇到类似问题时,它已经起作用了。我跑了
gcc -g -O2 -Wall tools/px.c -o tools/px
gcc -g -O2 supervisor/supervisor.c supervisor/utils.c \
-o supervisor/supervisor
supervisor/supervisor.c: In function 'kill_children':
supervisor/supervisor.c:149:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i=0; i<n_children; i++) {
^
supervisor/supervisor.c:149:5: note: use option -std=c99 or -std=gnu99 to compile your code
我收到了同样的错误,所以我尝试通过
直接从命令行安装包withr::with_makevars(c(PKG_CFLAGS = "-std=c99"), # Use C++ from '99
install.packages("processx"),
assignment = "+=")
# Alternatively, I tried
withr::with_makevars(c(PKG_CFLAGS = "-std=gnu99"), # Use C++ from '99
install.packages("processx"),
assignment = "+=")
当我在安装 ggplot2 时收到相同的错误时,这有效。我在其他 stackoverflow 帖子中读过 gcc,但我不熟悉这个过程。任何帮助将不胜感激!
R --no-save <<< "install.packages('processx', repos = 'http://cran.us.r-project.org')"