错误:打开缓存(E:在源列表 /etc/apt/sources.list.d/r-cran.list 的第 1 行中无法识别类型‘sudo’

错误:打开缓存(E:在源列表 /etc/apt/sources.list.d/r-cran.list 的第 1 行中无法识别类型‘sudo’

我正在尝试安装 R。我尝试了先前的帖子,没有成功。我使用的是 ubuntu 16.04.6 LTS 64 位。

我尝试了这个方法,但我的终端窗口似乎什么也没做,即使我试图关闭窗口时它显示有进程正在运行。我试了几次。现在我在顶部的灰色托盘中看到一条错误消息:

An error occurred, please run the package manager from the right-click menu or apt-get in a terminal to see what is wrong. 

错误信息如下:

Error: Opening the cache (E:type 'sudo' is not known on line 1 in source list /etc/apt/sources.list.d/r-cran.list,   
E:The list of sources could not be read.)

This usually means that your installed packages have unmet dependencies.

启动包管理器(通过通知)没有做任何事情,我收到此消息(附加图片):

E: Type 'sudo' is not known on line 1 in source list/etc/apt
sources.list.d/r-cran.list  
E: The list of sources could not be read. Go to the repository dialogue to correct the problem.  
E:_cache->open()failed, please report. 

我不知道如何进入存储库,也不知道如何报告。我该如何解决这个问题?

我也尝试了此链接同样,复制源代码并粘贴到终端,这可能不是如何做到这一点,但我不知道如何访问该/etc/apt/sources.list文件。

@heynnema 当我运行代码时,它显示 cat: /etc/apt/sources.list.d/r-cran.list: 没有这样的文件或目录

@heynnema 修复不起作用这里是终端的输出:

(gedit:2641): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:2641): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported
helwalaura@Galactica:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Executing: /tmp/tmp.L1dGqRuvRD/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: public key "Michael Rutter <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
helwalaura@Galactica:~$ sudo apt-get update
E: Type 'sudo' is not known on line 1 in source list /etc/apt/sources.list.d/r-cran.list
E: The list of sources could not be read.
helwalaura@Galactica:~$ 

@heynemma 这是结果cat /etc/apt/sources.list.d/r-cran.list

helwalaura@Galactica:~$ cat /etc/apt/sources.list.d/r-cran.list

sudo tee /etc/apt/sources.list.d/r-cran.list
sudo cat <<EOF | sudo tee /etc/apt/sources.list.d/r-cran.list
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

@heynnema 当我删除另外两行代码时,终端窗口中出现了以下内容:

(gedit:3157): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:3157): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:3157): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:3157): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported

答案1

为了尝试整理碎片,我们将从头开始...这应该可以帮助您入门...使用复制/粘贴以下几行,因为其中一些很长...

注意:这些“R”包的部分/全部都在 Ubuntu 19.10 存储库中。

terminal...

sudo -H gedit /etc/apt/sources.list.d/r-cran.list

将其添加为文件中的唯一行...

deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

保存文件并退出 gedit。

terminal...一次复制/粘贴一个命令到terminal...第一个命令很长...

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo apt-get update
sudo apt-get install r-base r-base-dev

来源:如何在 Ubuntu 16.04 Xenial 上安装 R?

来源:https://cran.r-project.org/bin/linux/ubuntu/README.html

更新#1:

剩菜...但很容易修复......

sudo -H gedit /etc/apt/sources.list

转到gedit首选项,并启用行号。

转到文件的最末尾(第 52 行),您可能会找到这样的一行......

deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

删除该行。保存文件并退出gedit

sudo apt-get update
sudo apt-get install r-base r-base-dev

我们就完成了!

相关内容