錯誤:開啟快取(E:type 'sudo' is notknown on line 1 in source list /etc/apt/sources.list.d/r-cran.list

錯誤:開啟快取(E:type 'sudo' is notknown on line 1 in source list /etc/apt/sources.list.d/r-cran.list

我正在嘗試安裝 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@銀河:~$ 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

我們應該完成了!

相關內容