这个问题与this question非常相关,但是存在一些细微差别。
我正在尝试在Windows上为二进制.zip文件构建一个包。
> devtools::build(binary = TRUE, args = c('--library="H:pathtolibrary"', '--preclean'))
"w:/R/R/R-33~1SQ.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "R:\path" --build --library="H:pathtolibrary" --preclean
* installing *source* package 'packagename' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* MD5 sums
Warning: running command '"zip" -r9Xq "R:/path" packagename' had status 127
running 'zip' failed
* DONE (independeR)
[1] "R:/path"
在其他问题中,我发现状态127对应于命令' zip'不存在。但是,我确实安装了Rtools。因为我没有在电脑上拥有管理员权限,并且我的用户设置在启动时被重置,Rtools/bin/
目录在启动时不在我的PATH中,但即使我将其添加回来,也确认它实际上是在CMD中,R仍然给出这个状态127。
C:\Users\jdubbeldam>path
PATH=C:/otherstuff;H:/Documents/Rtools/bin
在CMD上运行zip
并不会抱怨。
C:\Users\jdubbeldam>zip
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete OS files)
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-! use privileges (if granted) to obtain all aspects of WinNT security
-$ include volume label -S include system and hidden files
-e encrypt -n don't compress these suffixes
-h2 show more help
在这种情况下,链接问题中给出的解决方案都没有帮助。
R是否在内部使用不同的PATH变量,从R代码运行CMD命令?
有没有办法手动压缩devtools::build(binary = T)
的输出?