首页 > 解决方案 > 使用自制软件安装 R 后的终端

问题描述

按照此处的说明在 mac 上使用 homebrew 安装 R 后: https ://www.datacamp.com/community/tutorials/installing-R-windows-mac-ubuntu 。当我打开终端时,我得到这些:

-bash: /Users/myname/.bash_profile: line 27: syntax error near unexpected token `category="LC_ALL",'
-bash: /Users/myname/.bash_profile: line 27: `Sys.setlocale(category="LC_ALL", locale = "en_US.UTF-8")'

那么我怎样才能修复/摆脱这些出现在终端上的问题。

我认为这与以下内容有关:


$ echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile
$ echo "export LANG=en_US.UTF-8" >> ~/.bash_profile
$ echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile

标签: rhomebrew

解决方案


您链接的说明在步骤 3 中执行此操作以将内容添加到您的~/.bash_profile

echo 'Sys.setlocale(category="LC_ALL", locale = "en_US.UTF-8")' >> ~/.bash_profile

我认为这是错误的。那是 R 代码,而不是 bash 代码,所以它不应该进入~/.bash_profile. 它应该进去~/.Rprofile

从您的文件中删除第 27 行(上面写着Sys.setlocale(...)~/.bash_profile并将其添加到您的~/.Rprofile文件中。

然后向 DataCamp 发送一封电子邮件,告诉他们他们的 R 安装说明中存在重大错误。


推荐阅读