‘apt install’无法安装有效的软件包

‘apt install’无法安装有效的软件包

我下载了 vscode 到下载

me@host:~$ ls Downloads/code_1.31.1-1549938243_amd64.deb 
Downloads/code_1.31.1-1549938243_amd64.deb

使用apt安装,提示无法定位

me@host:~$ sudo apt install Downloads/code_1.31.1-1549938243_amd64.deb
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
E: Unable to locate package Downloads

由于我最终使用 gnome gui 安装了它,因此包状况良好。

我使用 ap install 有什么问题?

答案1

man apt,在关于的段落中install

A specific version of a package can be selected for installation by following the
package name with an equals (=) and the version of the package to select.
Alternatively the version from a specific release can be selected by following the
package name with a forward slash (/) and codename (jessie, stretch, sid ...) or suite
name (stable, testing, unstable).

因此aptDownloads其视为软件包名称,因为它是软件包的完美名称,其余部分视为目标。要使 apt 将其视为路径,路径必须以不能是软件包名称的内容开头,例如./

$ sudo apt install Downloads/bash*.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package Downloads

带有前导.

$ sudo apt install ./Downloads/bash*.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'bash' instead of './Downloads/bash_4.4.18-1ubuntu1~16.04.york0_amd64.deb'
bash is already the newest version (4.4.18-1ubuntu1~16.04.york0).
0 to upgrade, 0 to newly install, 0 to remove and 4 not to upgrade.

相关内容