【问题标题】:R Startup on Windows10- "The system cannot find the path specified." message. How can I find the path?R 在 Windows 10 上启动 - “系统找不到指定的路径。”信息。我怎样才能找到路径?
【发布时间】:2019-09-29 01:03:44
【问题描述】:

这没什么大不了的;一切似乎都正常,但每次在 Windows 10 上启动 R 时都会收到一条消息,这让我感到困扰:

C:\devl\temp>R
**The system cannot find the path specified.**

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

我重新安装了它,更改了 Rprofile.site 中的路径,弄乱了我的路径。我可以直接运行 R 可执行文件:

C:\R\R-3.6.1\bin>.\x64\R.exe
The system cannot find the path specified.

仍然会收到消息。

无论如何,我只是想更好地了解 R 的启动顺序,所以我很感激任何关于在哪里寻找 R 试图在启动时打开的路径的建议。

更新 @Pepv 的链接将我带到了启动包的 startup(debug=TRUE) 函数。在做了一些清理之后,下面是完整的输出。答案现在肯定是盯着我的脸。

C:\Users>R
The system cannot find the path specified.

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[1] "I'm the Rprofile.site in the R installation directory!"
[1] "I am the .Rprofile in C:/devl"
> startup::startup(debug = TRUE)
0.001s: System information:
0.007s: - R_HOME: 'C:/R/R-3.6.1' (existing folder)
0.012s: - R call: C:\R\R-3.6.1/bin/x64/Rterm.exe
0.017s: - Current directory: 'C:/Users'
0.022s: - User's home directory: '~' => 'C:\devl' (existing folder)
0.028s: - Search path: '.GlobalEnv', 'package:stats', 'package:graphics', 'package:grDevices', 'package:utils', 'package:datasets', 'package:methods', 'Autoloads', 'package:base'
0.044s: - Loaded namespaces: 'compiler', 'startup', 'graphics', 'utils', 'grDevices', 'stats', 'datasets', 'methods', 'base'
0.055s: The following has already been processed by R:
0.061s: - R_ENVIRON: ''
0.063s: - R_ENVIRON_USER: ''
0.068s: - R_DEFAULT_PACKAGES: '' (= 'base,methods,datasets,utils,grDevices,graphics,stats')
0.078s: - R_LIBS: 'C:\devl\Rpackages'
0.083s: - R_LIBS_SITE: ''
0.086s: - R_LIBS_USER: 'C:\devl\Rpackages'
0.090s: - R_PROFILE: ''
0.095s: - R_PROFILE_USER: 'C:\devl\.Rprofile' (1 lines; 42 bytes)
0.105s: - 'C:/R/R-3.6.1/etc/Rprofile.site' (2 code lines; 619 bytes)
0.117s: - 'C:\devl\.Rprofile' (1 code lines; 42 bytes)
0.124s: startup::startup()-specific processing ...
0.130s: Found startup directory '~/.Renviron.d'.
0.145s: Processing 1 Renviron files ...
0.153s:  - 'C:\devl/.Renviron.d/.Renviron' (0 lines; 0 bytes) setting 0 environment variables
0.164s: Processing 1 Renviron files ... done
0.177s: Found startup directory 'C:\devl\.Rprofile.d'.
0.188s: Processing 1 Rprofile files ...
0.196s:  - 'C:\devl\.Rprofile.d/.Rprofile' (1 code lines; 30 bytes)
[1] "I am in .Rprofile.d"
0.208s: Processing 1 Rprofile files ... done
0.216s: - unloading the 'startup' package
0.222s: - Search path: '.GlobalEnv', 'package:stats', 'package:graphics', 'package:grDevices', 'package:utils', 'package:datasets', 'package:methods', 'Autoloads', 'package:base'
0.238s: - Loaded namespaces: 'compiler', 'graphics', 'utils', 'grDevices', 'stats', 'datasets', 'methods', 'base'
0.250s: startup::startup()-specific processing ... done
0.257s: The following will be processed next by R:
0.262s: - R_HISTFILE: ''
0.274s: - .First(): no such function on search()
0.279s: - Remaining packages per R_DEFAULT_PACKAGES to be attached by base::.First.sys() (in order):

更新 2 或者可能不是。 Rterm.exe 不会触发该消息,并且根据this source,“R(与 Rterm 相对)是一个小型 .exe 程序,它的作用很小 参数解析,然后运行 ​​Rterm。”甚至 R.exe --help 都会触发消息,因此这必须与实际的 R.exe 参数解析有关。接近关闭此问题。

【问题讨论】:

  • 尝试在 .Rprofile 文件的开头和结尾放置 cat 语句以尝试缩小范围。同样从 Windows cmd 行输入 set R 以显示可能与 R 关联的任何环境变量。
  • 好主意。我在其中添加了一些额外的 cat 语句,我可以看到很多关于 startup::startup(debug=TRUE) 的情况。鉴于 R.exe --version, 显示消息,它似乎必须是 R.exe 的中心。

标签: r windows startup


【解决方案1】:

当 R 启动时,会进行以下用户特定的设置:

在 R 启动搜索路径中找到的第一个 .Renviron 文件是 处理。搜索路径是(按顺序): (i) Sys.getenv("R_ENVIRON_USER"), (ii) ./.Renviron, 和 (iii) ~/.Renviron。 该文件的格式是每行一个 ENV_VAR=VALUE 语句,参见。 ?.Renviron。注意:一些环境变量必须已经设置在 这一步是为了得到 R 的确认,即设置为时已晚 其中一些在下面的第 2 步和第 3 步中。

在 R 启动搜索路径中找到的第一个 .Rprofile 文件是 处理。搜索路径是(按顺序): (i) Sys.getenv("R_PROFILE_USER")、(ii) ./.Rprofile 和 (iii) ~/.Rprofile。 此文件的格式必须是有效的 R 脚本(带有尾随 换行符),参见。 ?.Rprofile.

如果 .Rprofile 文件(在步骤 2 中)调用 startup::startup(),则 以下也将发生:

一个。 R 启动搜索路径上的第一个 .Renviron.d 目录是 处理。搜索路径是(按顺序): (i) paste0(Sys.getenv("R_ENVIRON_USER"), ".d"), (ii) ./.Renviron.d, 和 (iii) ~/.Renviron.d。这些文件的格式应与 对于.Renviron。注意:一些环境变量必须已经设置在 上面的第 1 步,以便得到 R 的确认。

b.设置了一组可在步骤 3c 中使用的方便的 R 选项。他们的 名称以 startup.session 为前缀。 - 看 ?startup::startup_session_options 了解详情。

c。在 R 启动搜索路径上找到的第一个 .Rprofile.d 目录 被处理。搜索路径是(按顺序): (i) paste0(Sys.getenv("R_PROFILE_USER"), ".d"), (ii) ./.Rprofile.d, 和 (iii) ~/.Rprofile.d。这些文件的格式应与 对于 .Rprofile,即它们必须是有效的 R 脚本。

d。如果上面没有出现错误,启动包会被卸载, 不留下任何痕迹,除了 R 选项 startup.session.* 在步骤 3b 中设置 - 这些将被删除,如果 startup::startup() 使用 keep = NULL 调用。

https://cran.r-project.org/web/packages/startup/vignettes/startup-intro.html提取的信息

编辑:

检查这个解决方案,也许它也适合你:Problems executing script from command line in R. Error message: cannot find path specified

【讨论】:

  • 谢谢,你确实给了我一些想法。我确保您所写的环境变量已设置,甚至创建了 .Rprofile.d 和 .Renviron.d 目录并将 .Rprofile 和 .Renviron 文件放入其中。仍然收到该死的消息。将查看您链接到的启动介绍文档。
  • 不客气。检查我的答案的编辑,也许它对你有帮助。
  • 一定是相关的。我刚刚意识到,当我运行 Rterm.exe 而不是 R.exe 时,没有“系统找不到指定的路径”,即使 R.exe 应该是最新最好的。就像 Ohad 在他的错误中提到的那样,一定是 R.exe 正试图访问系统上的某些丢失文件。也许它来自R过去的鬼魂。我将把这个问题留一天左右,然后关闭它。
  • 嘿,这是另一种情况,有人从 R.exe 切换到 Rterm:r-bloggers.com/…
  • 一年后(我正在运行)R-3.6.3 仍然在我的情况下弹出相同的错误消息,甚至在 R.exe 启动之前,因为我删除了一些额外的启动选项。 The system cannot find the path specified. Fatal error: you must specify '--save', '--no-save' or '--vanilla' Rterm.exe 也运行时没有任何“找不到指定的路径”消息。我觉得奇怪的是,这只是最近才开始出现的。
猜你喜欢
  • 1970-01-01
  • 2012-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-23
相关资源
最近更新 更多