Windows 7 上的 R CMD 错误 - “R"不被识别为内部或外部命令, [英] R CMD on Windows 7 Error - "R" is not recognized as an internal or external command,

查看:43
本文介绍了Windows 7 上的 R CMD 错误 - “R"不被识别为内部或外部命令,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索在 Windows 7 上构建软件包,但在到达命令提示符阶段后遇到了麻烦.以下线程似乎与我遇到问题的主题相同,但问题仍未解决:

I'm exploring package building on Windows 7 but have been running into trouble after reaching the Command Prompt stage. The following thread appears to be on the same topic that I'm having trouble with, but the question remains unresolved:

问题:每当我在命令提示符中尝试 R CMD 命令时(例如,我尝试过 R CMD install pkgNameR cmd install pkgNameRcmd安装 pkgName,其中 pkgName 是实际包的占位符,该包已在 OS X 上经过 R CMD 检查 并发布在 CRAN 上,其中我在当前工作目录中有解压缩的源代码),我收到以下错误消息:

The problem: whenever I try an R CMD command in Command Prompt (e.g. I've tried R CMD install pkgName, R cmd install pkgName, Rcmd install pkgName, where pkgName is a place-holder for an actual package that has been R CMD checked on OS X and also posted on CRAN, where I have the unzipped source in the current working directory), I get the following error message:

'R' is not recognized as an internal or external command,
operable program or batch file.

(如果我尝试 Rcmd install pkgName 命令,那么错误开始为 'Rcmd' is not ....)请注意,即使我输入只需在命令提示符中使用 R 并按回车键,我就会得到同样的错误,所以我什至无法在此处调出 R,尽管它在其独立界面中打开得非常好.

(If I try the Rcmd install pkgName command, then the error starts out as 'Rcmd' is not ....) Note that even if I type in just R in Command Prompt and hit enter, I get the same error, so I'm not even able to bring up R here, though it opens perfectly fine in its stand-alone interface.

我检查了以下指南,但没有成功确定问题所在:

I have examined the following guides without success in identifying the trouble:

想到的最直接的事情是 Windows 中的路径变量设置不正确,但这也没有(还)导致答案.例如,我对路径进行了三次检查以确保它们是正确的,包括 R 版本号、路径名中的 x64 是否准确等.

The most immediate thing that came to mind was that the path variables in Windows were not set right, but this also has not (yet) led to the answer. For example, I have triple-checked the paths to ensure they are correct, including for the R version number, that x64 in the path name is accurate, etc.

我意识到这是一个远程诊断的复杂问题,但对于解决此问题的任何建议和建议表示赞赏.作为参考,以下是我为尝试解决此问题已采取的步骤:

I realize this is a complex issue to remotely diagnose, but any advice and suggestions on resolving this trouble is appreciated. For reference, below are the steps I have taken already to try to resolve this issue:

  • 卸载 R 和 Rtools
  • 安装最新版本的 R (2.15.0)立>
  • 安装 Rtools215 以匹配 R 版本 2.15.0
  • 最初我让 Rtools 指定路径变量(在安装过程中打开该选项).使用此方法后没有成功.
  • 我更新了计算机上的路径变量,其中使用了以下路径:

  • Uninstall R and Rtools
  • Install the latest version of R (2.15.0)
  • Install Rtools215 to match R version 2.15.0
  • Originally I let Rtools specify the path variables (turning that option on during installation). No success after this method.
  • I updated the path variables on my computer, where the below paths were used:

C:\Rtools\bin; C:\Program Files\R\R-2.15.0\bin\x64;

  • 我还尝试了包含以下路径的 R CMD(和 Rcmd)命令(请注意,这些路径不会导致任何我的电脑,所以我尝试在指定和不指定它们的情况下执行 R CMD/Rcmd:

  • I've also tried the R CMD (and Rcmd) commands with the following paths included (note that these paths don't lead to anything on my computer, so I tried doing R CMD / Rcmd with and without them specified):

    C:\Rtools\perl\bin; C:\Rtools\MinGW\bin;
    

  • 尝试添加/删除以下路径,该路径会转到 Rtools 文件夹中唯一可见的其他文件夹:

  • Tried adding/removing the following path, which goes to the only other folder visible within the Rtools folder:

    C:\Rtools\gcc-4.6.3;
    

  • 尝试了 R CMD 命令的多种变体,如前所述.

  • Tried multiple variations of the R CMD commands, as noted earlier.

    注意:我在 R 和 Rtools 之前已经安装了 Cygwin,我还没有安装 MikTeX(还没有).

    Note: I already had Cygwin installed prior to R and Rtools, and I have not installed MikTeX (yet).

    推荐答案

    • 您是否在调整 PATH 后关闭了命令提示符并打开了一个新的命令提示符?
    • 在命令行中输入命令 PATH 并确保正确更新路径
    • 尝试导航到保存 R.exe 的目录并在本地运行它 -- cd C:\Program...\bin\x64, R.exe.
    • 确保您在 Windows 的命令提示符而不是 Cygwin 的终端上运行
    • 如果您的 PATH 中的分号后确实有一个空格,则需要将其删除:/bin;C:/Program....尝试将其与 Joshua 的解决方案结合起来.
      • Have you closed the command prompt and opened a new one after adjusting the PATH?
      • Enter the command PATH on the command line and ensure that you are properly updating your path
      • Try navigating to the directory where R.exe is saved and running it locally -- cd C:\Program...\bin\x64, R.exe.
      • Ensure that you're running on Windows' Command Prompt and not Cygwin's terminal
      • If you actually have a space after the semi-colon in your PATH, you'll need to remove that: /bin;C:/Program.... Try combining that with Joshua's solution.
      • 这篇关于Windows 7 上的 R CMD 错误 - “R"不被识别为内部或外部命令,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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