我在使用 apt 安装 Ubuntu 20.04 操作系统的 virtualbox 6.1 时遇到问题。我使用本教程使用以下命令一路完成最后一步
$ sudo apt install virtualbox-6.1
这给了我一个错误
Reading package lists... Done
Building dependency tree
Reading state information... Done
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:
virtualbox-6.1 : Depends: python (< 2.8) but it is not installable
Depends: python (>= 2.7) but it is not installable
Depends: python:any (>= 2.6.6-7~)
Recommends: libsdl-ttf2.0-0 but it is not installable
E: Unable to correct problems, you have held broken packages.
apt-cache 策略 virtualbox-6.1 是这样的。
Installed: (none)
Candidate: 6.1.18-142142~Ubuntu~eoan
Version table:
6.1.18-142142~Ubuntu~eoan 500
500 https://download.virtualbox.org/virtualbox/debian eoan/contrib amd64 Packages
6.1.16-140961~Ubuntu~eoan -1
100 /var/lib/dpkg/status
它仍然有 Python 问题,看起来
$ python --version
Python 3.8.5
$ python3 --version
Python 3.8.5
$ dpkg -l python
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================================================
rc python 2.7.17-1 amd64 interactive high-level object-oriented language (Python2 version)
$ dpkg -l python3
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-==============-============-=========================================================================
ii python3 3.8.2-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
答案1
尝试这个...
sudo apt autoremove --purge virtualbox*
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian `lsb_release -sc` contrib" | sudo tee --append /etc/apt/sources.list.d/virtualbox.list
sudo apt instal virtualbox-6.1