Ubuntu20.04 VirtualBox 6.1安装失败(deb)

平台

Ubuntu20.04 + VirtualBox 6.16

问题

早上开机, 突然发现virtualbox崩溃了, 历史重演, 果断卸载重装
(VB是个让人又爱又恨的东西, 折腾去解决现有的问题不如重装来得快).


下载VirtualBox 6.16安装包和扩展包后, 使用dpkg -i *.deb 失败, log 如下:

$ sudo dpkg -i virtualbox-6.1_6.1.16-140961_Ubuntu_eoan_amd64.deb

Selecting previously unselected package virtualbox-6.1.
(Reading database ... 251172 files and directories currently installed.)
Preparing to unpack virtualbox-6.1_6.1.16-140961_Ubuntu_eoan_amd64.deb ...
Unpacking virtualbox-6.1 (6.1.16-140961~Ubuntu~eoan) ...
dpkg: dependency problems prevent configuration of virtualbox-6.1:
 virtualbox-6.1 depends on python (<< 2.8); however:
  Package python is not installed.
 virtualbox-6.1 depends on python (>= 2.7); however:
  Package python is not installed.
 virtualbox-6.1 depends on python:any (>= 2.6.6-7~); however:

dpkg: error processing package virtualbox-6.1 (--install):
 dependency problems - leaving unconfigured
Processing triggers for systemd (245.4-4ubuntu3.3) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (1.15-1) ...
Errors were encountered while processing:
 virtualbox-6.1

  • 前面还缺少两个信赖包, 已安装上

sudo apt-get install libqt5opengl5 libqt5printsupport5

Python版本问题

很奇怪的问题是提示的python(2.7 <= 要求版本 << 2.8)包都已正确安装, 但就是找不到

# 当前版本
$ sudo python --version
Python 2.7.18
$ sudo which python
/usr/bin/python
$ ll /usr/bin/python
lrwxrwxrwx 1 root root 18 11月  3 09:13 /usr/bin/python -> /usr/bin/python2.7*
$ ll /usr/bin/python2.7
-rwxr-xr-x 1 root root 3629032 8月   4 19:16 /usr/bin/python2.7*

# 其它信息:
$ ll /usr/bin/python*
lrwxrwxrwx 1 root root      18 11月  3 09:13 /usr/bin/python -> /usr/bin/python2.7*
lrwxrwxrwx 1 root root       9 3月  13  2020 /usr/bin/python2 -> python2.7*
-rwxr-xr-x 1 root root 3629032 8月   4 19:16 /usr/bin/python2.7*
lrwxrwxrwx 1 root root       9 11月  2 18:22 /usr/bin/python3 -> python3.8*
-rwxr-xr-x 1 root root 5486352 7月  28 20:59 /usr/bin/python3.8*
lrwxrwxrwx 1 root root      33 7月  28 20:59 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config*
lrwxrwxrwx 1 root root      16 3月  13  2020 /usr/bin/python3-config -> python3.8-config*
-rwxr-xr-x 1 root root     384 3月  28  2020 /usr/bin/python3-futurize*
-rwxr-xr-x 1 root root     388 3月  28  2020 /usr/bin/python3-pasteurize*

搜索一番后找到 [Solved ]Python2 dependency hell, 装上 python-is-python2可以解决

$ sudo apt install python-is-python2

装上后, /usr/bin下的python发生了变化:

$ ll /usr/bin/python*
lrwxrwxrwx 1 root root       7 4月  15  2020 /usr/bin/python -> python2*
lrwxrwxrwx 1 root root       9 3月  13  2020 /usr/bin/python2 -> python2.7*
-rwxr-xr-x 1 root root 3629032 8月   4 19:16 /usr/bin/python2.7*
lrwxrwxrwx 1 root root       9 11月  2 18:22 /usr/bin/python3 -> python3.8*
-rwxr-xr-x 1 root root 5486352 7月  28 20:59 /usr/bin/python3.8*
lrwxrwxrwx 1 root root      33 7月  28 20:59 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config*
lrwxrwxrwx 1 root root      16 3月  13  2020 /usr/bin/python3-config -> python3.8-config*
-rwxr-xr-x 1 root root     384 3月  28  2020 /usr/bin/python3-futurize*
-rwxr-xr-x 1 root root     388 3月  28  2020 /usr/bin/python3-pasteurize*

再次安装VirtualBox, 成功.

引用

  1. VirtualBox 6.1.16 Oracle VM VirtualBox Extension Pack
  2. Ubuntu 19.10 / 20.04 (deb)
  3. [Solved ]Python2 dependency hell

你可能感兴趣的:(Linux,VirtualBox,python,python2)