解决ubuntu20.04无法安装python2-pyqt5

问题

有个程序是python2写的,依赖pyqt5

之前在ubuntu18.04下通过 suod apt install python-pyqt5能顺利安装

升级Ubuntu20.04后发现apt源已不能安装

解决

手动添加bionic源并安装一个虚假qtbase依赖

qtbase-abi-fake

# create the package structure:
cd /tmp
mkdir qtbase-abi-fake
mkdir -p qtbase-abi-fake/DEBIAN
mkdir -p qtbase-abi-fake/usr/lib/qtbase-abi-fake
touch qtbase-abi-fake/usr/lib/qtbase-abi-fake/nothing.txt

# create the deb control file (the guts):
cat <<_EOF > qtbase-abi-fake/DEBIAN/control
Package: qtbase-abi-fake
Version: 5.9.5
Section: custom
Priority: optional
Architecture: all
Essential: no
Installed-Size: 1024
Maintainer: atlas
Description: Fakes out python-pyqt5 from Ubuntu 18.04 to work on 20.04  
Provides: qtbase-abi-5-9-5
_EOF

# build the qtbase-abi-fake.deb file:
dpkg-deb --build qtbase-abi-fake

# install your newly created deb file:
sudo dpkg -i qtbase-abi-fake.deb

bionic

echo 'deb http://us.archive.ubuntu.com/ubuntu/ bionic universe multiverse' | sudo tee /etc/apt/sources.list.d/bionic-helper.list

install

sudo apt update
sudo apt install python-pyqt5.qtwebkit

参考

https://askubuntu.com/questions/1254347/how-to-get-pyqt5-for-python2-on-ubuntu-20-04