问题在具有空间
问题描述:
的路径调用可执行文件时我只是一个新的微软Windows 7的计算机上安装R和使用命令行的时候,我在下面的错误运行:问题在具有空间
"C:\Program Files\R\R-3.3.2\bin\Rscript.exe" --version
'C:\Program' is not recognized as an internal or external command,
运行的程序或批处理文件。
请注意,我已经在空间的路径上添加了引号。而我在系统路径中添加:
;C:\Program Files\R\R-3.3.2\bin\
有趣的是:
- 如果我只是把这种
Rscript.exe --version
它给出了同样的错误,这是非常奇怪的:如果它发现它,为什么它不能运行它!?! 我能找到的唯一解释是,寻找Rscript.exe的依赖 - 我也注意到,这个工程
"C:\Program Files\R\R-3.3.3\bin\x64\Rscript.exe" --version
(这两个文件夹...\bin
和...\bin\x64
有一个可执行Rscript.exe)
最后,我确认这是一个R特定的问题,因为我在Program Files的子文件夹中尝试过的所有其他可执行文件都可以通过相同的命令行界面调用!
答
退房
C:\Users>Rscript --help
Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args]
--options accepted are
--help Print usage and exit
--version Print version and exit
--verbose Print information on progress
--default-packages=list
Where 'list' is a comma-separated set
of package names, or 'NULL'
or options to R, in addition to --slave --no-restore, such as
--save Do save workspace at the end of the session
--no-environ Don't read the site and user environment files
--no-site-file Don't read the site-wide Rprofile
--no-init-file Don't read the user R profile
--restore Do restore previously saved objects at startup
--vanilla Combine --no-save, --no-restore, --no-site-file
--no-init-file and --no-environ
'file' may contain spaces but not shell metacharacters
Expressions (one or more '-e <expr>') may be used *instead* of 'file'
See also ?Rscript from within R
追求你的理论,一些依赖是有过错的,我希望--verbose所表示的是其他文件RSCRIPT尝试读取。没有这样的运气。
顺便说一下,除非我为Rscript提供一些命令,否则几乎没有这些选项可用于我,否则它会一直抱怨“文件名已丢失”。因此,任何与这些可能性,你可以去的东西像
C:\Users>Rscript --verbose -e print(2+2)
话虽这么说,你可能会进一步通过使用选项,如--no-environ
,--no-site-file
,--vanilla
等追求你的理论,使其跳过任何文件依赖关系,看看它是否让你在某个地方。
答
我一直在试图复制您的问题,我发现一件事情在你的问题:你提到这不起作用:
"C:\Program Files\R\R-3.3.2\bin\Rscript.exe" --version
'C:\Program' is not recognized as an internal or external command,
但这:
"C:\Program Files\R\R-3.3.3\bin\x64\Rscript.exe" --version
看来,你在使用R-3.3.3的例子中工作,在R-3.3.2的例子中使用R-3.3.2。
所以我会假设,如果你把它改为
"C:\Program Files\R\R-3.3.3\bin\Rscript.exe" --version
它应该工作。
您的Q标题与您的Q无关? – MichaelChirico
@MichaelChirico这不是一个真正的R问题:-) –
不能重现这一点。调用'>“C:\ Program Files \ R \ R-3.3.3 \ bin \ Rscript.exe”--version'导致为前端版本3的脚本。3.3(2017-03-06)' – Heikki