问题描述
当我尝试运行以下命令时:R --slave --no-save --no-restore -e "print('foo')"
When I try to run the following command:R --slave --no-save --no-restore -e "print('foo')"
我得到:/usr/local/bin/R: line 193:/usr/local/Library/ENV/4.3/sed: 没有那个文件或目录错误:选项-e"需要一个非空参数
显然 brew
最近将 ENV
文件夹移动到一个新路径(见 此处).我知道我可以轻松地对新的 sed 目录进行符号链接以解决问题,但我想知道是否有更好的解决方法/修复(以及最终是否会在 R 源代码中修复).
Apparently brew
recently moved the ENV
folder to a new path (see here). I know I can easily symlink the new sed dir to fix the issue but I wanted to know if there is a better workaround / fix (and eventually if this will be fixed in the R source code).
推荐答案
发生这种情况是因为 brew
改变了它在 这次提交 所以如果你在过去 4 天内运行了 brew update
,这就是造成损坏的原因.
This happens because brew
has changed it's paths in this commit so if you've run brew update
in the last 4 days, this is what has caused the breakage.
为此 blindjesse3839#issuecomment-233742983">答案,即brew重新安装-sr
.
Credit goes to blindjesse for this answer, which is to brew reinstall -s r
.
不过,我在尝试此操作时遇到了其他一些问题.我没有安装 X11,并且与 tcl-tk
发生冲突,这意味着它在编译时导致了其他一些失败:
I ran into some other issues when I tried this though. I didn't have X11 installed and I had a conflict with the tcl-tk
which meant that it caused some other failures when it was compiling so:
- 我从 https://www.xquartz.org 安装了 XQuartz
- 符号链接到我的 homebrew 文件夹
ln -s/opt/X11/include/X11/usr/local/include/X11
(注意你的 homebrew 目录可能不同) brew install homebrew/dupes/tcl-tk酿造链接 --overwrite --force tcl-tk;brew unlink tcl-tk
brew 重新安装 -s r
- I installed XQuartz from https://www.xquartz.org
- Symlinked it to my homebrew folder
ln -s /opt/X11/include/X11 /usr/local/include/X11
(note that your homebrew directory may be different) brew install homebrew/dupes/tcl-tkbrew link --overwrite --force tcl-tk; brew unlink tcl-tk
brew reinstall -s r
然后它对我有用.我认为一旦 r
瓶子升级,这个问题应该会消失,但目前这是我必须做的.
And then it worked for me. I think once the r
bottle is upgraded this issue should disappear but for the moment this is what I had to do.
这篇关于使用 -e 标志运行 R 时找不到 sed 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!