百度直接输入vscode,进行搜索,点击进入vscode的下载页面,选择deb格式进行下载,
然后cd到download文件夹找到下载的安装包。
sudo apt install vscode安装包
提示错误:
The following packages have unmet dependencies:
code:amd64 : Depends: libasound2:amd64 (>= 1.0.17) but it is not installable
Depends: libatk-bridge2.0-0:amd64 (>= 2.5.3) but it is not installable
Depends: libatk1.0-0:amd64 (>= 2.2.0) but it is not installable
Depends: libatspi2.0-0:amd64 (>= 2.9.90) but it is not installable
Depends: libc6:amd64 (>= 2.14) but it is not installable
Depends: libc6:amd64 (>= 2.16) but it is not installable
Depends: libc6:amd64 (>= 2.17) but it is not installable
Depends: libc6:amd64 (>= 2.2.5) but it is not installable
Depends: libcairo2:amd64 (>= 1.6.0) but it is not installable
Depends: libcurl3-gnutls:amd64 but it is not installable or
libcurl3-nss:amd64 but it is not installable or
libcurl4:amd64 but it is not installable or
libcurl3:amd64 but it is not installable
Depends: libdbus-1-3:amd64 (>= 1.5.12) but it is not installable
Depends: libdrm2:amd64 (>= 2.4.75) but it is not installable
Depends: libexpat1:amd64 (>= 2.0.1) but it is not installable
Depends: libgbm1:amd64 (>= 17.1.0~rc2) but it is not installable
Depends: libglib2.0-0:amd64 (>= 2.16.0) but it is not installable
Depends: libglib2.0-0:amd64 (>= 2.37.3) but it is not installable
Depends: libgssapi-krb5-2:amd64 but it is not installable
Depends: libgtk-3-0:amd64 (>= 3.9.10) but it is not installable
Depends: libgtk-3-0:amd64 (>= 3.9.10) but it is not installable or
libgtk-4-1:amd64 but it is not installable
Depends: libkrb5-3:amd64 but it is not installable
Depends: libnspr4:amd64 (>= 2:4.9-2~) but it is not installable
Depends: libnss3:amd64 (>= 2:3.30) but it is not installable
Depends: libnss3:amd64 (>= 3.26) but it is not installable
Depends: libpango-1.0-0:amd64 (>= 1.14.0) but it is not installable
Depends: libsecret-1-0:amd64 (>= 0.18) but it is not installable
Depends: libx11-6:amd64 but it is not installable
Depends: libx11-6:amd64 (>= 2:1.4.99.1) but it is not installable
Depends: libxcb1:amd64 (>= 1.9.2) but it is not installable
Depends: libxcomposite1:amd64 (>= 1:0.4.4-1) but it is not installable
Depends: libxdamage1:amd64 (>= 1:1.1) but it is not installable
Depends: libxext6:amd64 but it is not installable
Depends: libxfixes3:amd64 but it is not installable
Depends: libxkbcommon0:amd64 (>= 0.4.1) but it is not installable
Depends: libxkbfile1:amd64 but it is not installable
Depends: libxrandr2:amd64 but it is not installable
Recommends: libvulkan1:amd64 but it is not installable
E: Unable to correct problems, you have held broken packages.
网上搜了一下,说是源的问题,我就
sudo gedit /etc/apt/sources.list
将内容更换为链接中的内容了。
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
然后回到download,继续安装vscode,仍旧提示上述错误 。。。。。
最后发现是下载的安装包版本太新了。。。。
换了个旧的安装包,成功安装了。
以后避坑吧。