-+-SOLVED-+-如何在debian 9上安装VSCODE?没用

时间:2019-04-26 09:02:16

标签: visual-studio-code vscode-settings

我正在尝试安装Visual Studio代码。

我的树莓。版本是:

分销商ID:Raspbian

说明:Raspbian GNU / Linux 9.8(拉伸)

发布:9.8

代号:stretch

我尝试了几种方法(开始下载.deb并使用dpkg或install命令),但是没有任何效果。

我该如何解决此问题?我真的需要VSC,因为我的项目正在发展,而Geany搞砸了。

从官方网站下载了.deb和.tar文件,遵循安装说明,但出现此错误

使用dpkg(32位和64位):

"package architecture (amd64) does not match system (armhf)"

"package architecture (i386) does not match system (armhf)"

使用sudo安装:

sudo apt install ./code_1.33.1-1554971066_amd64.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'code:amd64' instead of './code_1.33.1-1554971066_amd64.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 code:amd64 : Depends: libnotify4:amd64 but it is not installable
              Depends: libnss3:amd64 (>= 2:3.26) but it is not installable
              Depends: apt:amd64 but it is not installable
              Depends: libxkbfile1:amd64 but it is not installable
              Depends: libsecret-1-0:amd64 but it is not installable
              Depends: libgtk-3-0:amd64 (>= 3.10.0) but it is not installable
              Depends: libxss1:amd64 but it is not installable
E: Unable to correct problems, you have held broken packages.

使用存储库:

pi@raspberrypi:~/Downloads $ sudo apt-get update
Err:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
  Temporary failure resolving 'raspbian.raspberrypi.org'
Err:2 http://archive.raspberrypi.org/debian stretch InRelease
  Temporary failure resolving 'archive.raspberrypi.org'
Err:3 https://packages.microsoft.com/repos/vscode stable InRelease
  Could not resolve host: packages.microsoft.com
Reading package lists... Done
W: Failed to fetch http://raspbian.raspberrypi.org/raspbian/dists/stretch/InRelease  Temporary failure resolving 'raspbian.raspberrypi.org'
W: Failed to fetch http://archive.raspberrypi.org/debian/dists/stretch/InRelease  Temporary failure resolving 'archive.raspberrypi.org'
W: Failed to fetch https://packages.microsoft.com/repos/vscode/dists/stable/InRelease  Could not resolve host: packages.microsoft.com
W: Some index files failed to download. They have been ignored, or old ones used instead.
pi@raspberrypi:~/Downloads $ sudo apt-get install code
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package code

我对此问题感到生气,我尝试使用较旧的存储库,但是它们不起作用。

感谢您的帮助, GF

1 个答案:

答案 0 :(得分:1)

Community builds of Visual Studio Code可用(用于Raspberry Pi和其他ARM和Intel系统)。

这些软件包当前以DEB和RPM格式提供。您可以使用here提供的脚本来安装软件包并将其存储库添加到系统中或手动安装。

下面我总结了这些步骤:


  

打开一个新终端。如果需要超级用户权限(可能需要),则可以输入sudo -s并按回车键以进入超级用户会话。运行当前发行版的安装程序:

     

APT说明

     

(包括Debian,Raspbian,Ubuntu和Linux Mint)

     
. <( wget -O - https://code.headmelted.com/installers/apt.sh )
     

按返回键。安装程序完成后,您应该在桌面程序列表中有一个“代码-OSS”条目。

     

手动安装

     

如果以上脚本由于某种原因无法在您的系统上运行,或者您不想添加软件包更新源,请在下面获取系统的软件包最新版本。

     

公共GPG密钥

     

对于APT或YUM安装,您需要公共GPG密钥来验证软件包,然后可以下载here

     

APT和YUM软件包

     

最新的软件包可直接从PackageCloud releases page获得。

您需要的特定软件包可用here


编辑:

当前(29.04.2019)当前版本(v。1.32)似乎适用于所有人。请参阅:issue#64。看来您必须go back to v. 1.29,据报道运行良好。

您可以选择this package并手动进行安装,也可以使用APT。如果决定通过APT安装它,请注意,您必须按照以下说明标记软件包on hold

要防止code-oss升级(以便在问题解决之前可以保持1.29版),请遵循these instructions

  

通过APT安装1.29版:

     
apt-get install code-oss=1.29.0-1539702286
     

然后通过运行以下命令将其标记为保留

     
apt-mark hold code-oss
     

现在运行apt-get upgrade直到您运行之前都不会尝试提高它:

     
apt-mark unhold code-oss
     

这将允许它像往常一样再次升级。