创建 zip 文件:运行命令时出错"状态为 127 [英] Create zip file: error running command " " had status 127
本文介绍了创建 zip 文件:运行命令时出错"状态为 127的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 r 中的 zip
函数从多个文件创建一个 zip 文件,但我不断收到此错误消息:运行命令 '"zip" -r9X "data.zip" "dt1.txt" "dt2.txt" ' 的状态为 127.
I am trying to create a zip file from multiple files using the zip
function in r, but I keep getting this error message:
running command '"zip" -r9X "data.zip" "dt1.txt" "dt2.txt" ' had status 127.
我怎样才能避免这种情况?
How can I avoid that?
setwd()
dt1 <- sample(1:100, 10)
dt2 <- sample(100:200, 10)
write(dt1, "dt1.txt")
write(dt2, "dt2.txt")
zip('data.zip', files =c('dt1.txt',
'dt2.txt'))
推荐答案
以下是我在 Windows 7 计算机上解决此问题的方法:
Here is how I solved this problem on my Windows 7 computer:
- 从此处安装
Rtools
. - 找到安装
Rtools
的文件夹.就我而言,它位于C:\Rtools
. - 将
C:\Rtools\bin
路径添加到系统路径.
- Install
Rtools
from HERE. - Locate the folder that
Rtools
is installed. In my case it is atC:\Rtools
. - Add
C:\Rtools\bin
path to the system path.
添加C:\Rtools\bin
到系统路径:
- 转到
控制面板>>系统和安全 >>系统
- 转到
高级系统设置
- 打开
高级
标签 - 点击
环境变量...
按钮 - 选择
Path
变量并点击Edit
按钮 - 如果没有什么作为变量值",您可以简单地编写
C:\Rtools\bin
.如果已经存在一个值,则将;C:\Rtools\bin
添加到它的末尾. - 点击确定,确定...
- 重新启动 R,它应该可以工作了.
- Go to
Control Panel >> System and Security >> System
- Go to
Advanced System Settings
- Open
Advanced
tab - Click
Environmental Variables...
button - Select
Path
variable and clickEdit
button - If there is nothing as a "Variable Value" you can simply write
C:\Rtools\bin
. If there is already a value, then add;C:\Rtools\bin
to the end of it. - Click OK, OK...
- Restart R, it should work.
我希望这会有所帮助.我在这里找到了解决方案.
I hope this helps. I found the solution HERE.
这篇关于创建 zip 文件:运行命令时出错"状态为 127的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文