![跳过对包的明确选择(并强制下载最新版本)](https://linux22.com/image/1132619/%E8%B7%B3%E8%BF%87%E5%AF%B9%E5%8C%85%E7%9A%84%E6%98%8E%E7%A1%AE%E9%80%89%E6%8B%A9%EF%BC%88%E5%B9%B6%E5%BC%BA%E5%88%B6%E4%B8%8B%E8%BD%BD%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%EF%BC%89.png)
我输入sudo apt-get install lua
并得到以下内容:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package lua is a virtual package provided by:
lua5.3:i386 5.3.1-1
lua5.2:i386 5.2.4-1
lua5.1:i386 5.1.5-8
lua50 5.0.3-7
lua5.3 5.3.1-1
lua5.2 5.2.4-1
lua5.1 5.1.5-8
You should explicitly select one to install.
E: Package 'lua' has no installation candidate
我认为该软件包的作者希望您手动选择要安装的软件包。
有没有办法强制直接下载最新的软件包(在本例中为 5.3)?
答案1
快速破解一下:
sudo apt-get install \
$(sudo apt-get install -s lua | \
awk '/^ +lua/' | \
cut -d : -f 1 | \
sort -Vu -k2 | \
awk 'END {print $1}')
或者
package="lua"
sudo apt-get install \
$(sudo apt-get install -s "$package" | \
awk '/^ +'"$package"'/' | \
cut -d : -f 1 | \
sort -Vu -k2 | \
awk 'END {print $1}')
$ sudo apt-get install \
$(sudo apt-get install -s lua | \
awk '/^ +lua/' | \
cut -d : -f 1 | \
sort -Vu -k2 | \
awk 'END {print $1}')
E: Package 'lua' has no installation candidate
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
lua5.3
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 103 kB of archives.
After this operation, 379 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ wily/main lua5.3 amd64 5.3.1-1 [103 kB]
Fetched 103 kB in 0s (215 kB/s)
Selecting previously unselected package lua5.3.
(Reading database ... 419661 files and directories currently installed.)
Preparing to unpack .../lua5.3_5.3.1-1_amd64.deb ...
Unpacking lua5.3 (5.3.1-1) ...
Processing triggers for man-db (2.7.4-1) ...
Setting up lua5.3 (5.3.1-1) ...