创建 zip 文件:运行命令时出错"状态为 127 [英] Create zip file: error running command " " had status 127

查看:27
本文介绍了创建 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:

  1. 此处安装Rtools.
  2. 找到安装 Rtools 的文件夹.就我而言,它位于 C:\Rtools.
  3. C:\Rtools\bin 路径添加到系统路径.
  1. Install Rtools from HERE.
  2. Locate the folder that Rtools is installed. In my case it is at C:\Rtools.
  3. Add C:\Rtools\bin path to the system path.

添加C:\Rtools\bin到系统路径:

  1. 转到控制面板>>系统和安全 >>系统
  2. 转到高级系统设置
  3. 打开高级标签
  4. 点击环境变量...按钮
  5. 选择Path变量并点击Edit按钮
  6. 如果没有什么作为变量值",您可以简单地编写C:\Rtools\bin.如果已经存在一个值,则将 ;C:\Rtools\bin 添加到它的末尾.
  7. 点击确定,确定...
  8. 重新启动 R,它应该可以工作了.
  1. Go to Control Panel >> System and Security >> System
  2. Go to Advanced System Settings
  3. Open Advanced tab
  4. Click Environmental Variables... button
  5. Select Path variable and click Edit button
  6. 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.
  7. Click OK, OK...
  8. Restart R, it should work.

我希望这会有所帮助.我在这里找到了解决方案.

I hope this helps. I found the solution HERE.

这篇关于创建 zip 文件:运行命令时出错&quot;状态为 127的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆