我正在尝试使用我的 Linux 终端和命令安装 VSCode sudo apt install code
,但它给了我这个错误:
E: Unable to locate package code
我尝试过运行sudo apt update
,但仍然遇到同样的错误。请问我该如何修复它?
答案1
VScode 文档:Linux 上的 Visual Studio 代码
sudo apt install wget gpg apt-transport-https
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/microsoft-archive-keyring.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code
通过快照:
sudo apt install snapd
sudo snap install code --classic
sudo snap run code