繁体   English   中英

R 在 Windows10 上启动-“系统找不到指定的路径。” 信息。 我怎样才能找到路径?

[英]R Startup on Windows10- “The system cannot find the path specified.” message. How can I find the path?

这没什么大不了的。 一切似乎都在工作,但每次我在 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) function。 经过一番清理,下面是完整的 output。 答案现在必须盯着我看。

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 不会触发该消息,并且根据此来源,“R(与 Rterm 相对)是一个 small.exe 程序,它会进行一些参数解析,然后运行 Rterm。” 甚至 R.exe --help 都会触发消息,因此这必须与实际的 R.exe 参数解析有关。 接近结束这个问题。

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

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

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

如果 .Rprofile 文件(在第 2 步中)调用了 startup::startup(),那么也会发生以下情况:

一个。 处理R启动搜索路径上的first.Renviron.d目录。 搜索路径是(按顺序):(i) paste0(Sys.getenv("R_ENVIRON_USER"), ".d"), (ii)./.Renviron.d, 和 (iii) ~/.Renviron.d。 这些文件的格式应该与 for.Renviron 相同。 注意:为了被 R 确认,必须在上面的步骤 1 中已经设置了一些环境变量。

湾。 设置了可在步骤 3c 中使用的一组方便的 R 选项。 它们的名称以 startup.session 为前缀。 - 有关详细信息,请参阅?startup::startup_session_options。

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

d。 If no errors occur above, the startup package will be unloaded, leaving no trace of itself behind, except for R options startup.session.* set in Step 3b - these will be erased if startup::startup() is called with keep = NULL。

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

编辑:

检查这个解决方案,也许它也适合你: Problems execution script from command line in R。 错误信息:找不到指定的路径

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM