当我尝试运行从 Epson 网站下载的打印机实用程序时出现以下错误:
epson-printer-utility: error while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory
我推测这是因为 Ubuntu 20.04 LTS 上未安装 QT4 库。而且似乎无法再安装。
我在 Google 上搜索过,并尝试通过各种方式安装各种 QT4 库,但均未成功。例如:
$ sudo apt-get install qt4-default
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package qt4-default is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'qt4-default' has no installation candidate
请帮助。
我是 Linux 新手,所以请具体告诉我我需要做什么!
答案1
Ubuntu 20.04 LTS 不再有 Qt4 库。看这个问题,例如。你最好的选择是从源代码编译, 或者设置虚拟机使用旧版本 Ubuntu 作为客户操作系统。
或者,如果你想要冒险,你可以添加此 PPA,然后安装Qt4:
sudo apt-add-repository ppa:rock-core/qt4
sudo apt update
sudo apt install qt4-default
这qt5-default
将从您的系统中删除。让我们将其添加回来:
sudo apt install qt5-default
现在您已经在系统中安装了 Qt4 和 Qt5 库脆弱的平衡。下次运行sudo apt autoremove
清理已安装的软件包时,Qt4 库将被删除。让我们防止这种情况发生:
sudo apt install libodbc1 libqt4-dbus libqt4-declarative libqt4-designer libqt4-dev libqt4-dev-bin libqt4-help libqt4-network libqt4-opengl libqt4-opengl-dev libqt4-qt3support libqt4-script libqt4-scripttools libqt4-sql libqt4-sql-odbc libqt4-svg libqt4-test libqt4-xml libqt4-xmlpatterns libqtcore4 libqtdbus4 libqtgui4 qdbus qt4-linguist-tools qt4-qmake qtcore4-l10n
答案2
以下对我有用Ubuntu 20.10为了epson-printer-utility_1.1.1-1lsb3.2_amd64.deb
下载以下bionic
软件包:
http://mirrors.kernel.org/ubuntu/pool/universe/q/qt4-x11/libqtcore4_4.8.7+dfsg-7ubuntu1_amd64.deb
http://mirrors.kernel.org/ubuntu/pool/universe/q/qt4-x11/libqtgui4_4.8.7+dfsg-7ubuntu1_amd64.deb
从中提取以下文件:
libQtCore.so.4.8.7
libQtGui.so.4.8.7
将这两个文件复制到/usr/lib/x86_64-linux-gnu
。假设包含上述文件的文件夹是终端中的当前文件夹:
sudo cp libQtCore.so.4.8.7 /usr/lib/x86_64-linux-gnu/
sudo cp libQtGui.so.4.8.7 /usr/lib/x86_64-linux-gnu/
在以下位置建立适当的符号链接/usr/lib/x86_64-linux-gnu
:
cd /usr/lib/x86_64-linux-gnu/
sudo ln -s libQtCore.so.4.8.7 libQtCore.so.4
sudo ln -s libQtGui.so.4.8.7 libQtGui.so.4
以上使得爱普生打印机实用程序启动并运行。但它的功能……嗯,令人失望。提供的所有功能都可以在设备本身上执行。
注意:以下消息似乎不会损害应用程序。
Gtk-Message:无法加载模块“overlay-scrollbar”
可以通过安装overlay-scrollbar-gtk2
包来修复:
sudo apt install overlay-scrollbar-gtk2
答案3
您可以下载以前版本的 libqt4 软件包,解压它们,并epson-printer-utility
通过设置来使用它们LD_LIBRARY_PATH
。我写了一个脚本:
https://gist.github.com/derde/025a1cdbfadc3e56dc6a46093d922c32
#! /bin/bash
# Run epson-printer-utility from epson-printer-utility_1.0.2-1lsb3.2_amd64.deb
# using downloaded libqt4 libraries from previous Ubuntu version (not provided
# in Ubuntu 20.04 "focal fossa"
#
# This downloads the deb files and extracts them in a libs directory in the
# current directory, and then runs the utility
#
# Fix for:
# epson-printer-utility: error while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory
DEBS='
http://mirrors.kernel.org/ubuntu/pool/universe/q/qt4-x11/libqtgui4_4.8.7+dfsg-7ubuntu3_amd64.deb
http://mirrors.kernel.org/ubuntu/pool/universe/q/qt4-x11/libqtcore4_4.8.7+dfsg-7ubuntu3_amd64.deb
'
cd `dirname $0`
mkdir -p libs
cd libs
echo "## `pwd`"
if ! [ -f data.tar.zx ] ; then
for DEB in $DEBS; do
FILE="${DEB/*\/}"
[ -f "$FILE" ] && continue
echo "## download $DEB"
wget $DEB
echo "## extract $FILE"
ar x $FILE
tar -xJf data.tar.xz
rm control.tar.xz data.tar.xz debian-binary
done
fi
echo "## run epson-printer-utility with `pwd`"
LD_LIBRARY_PATH=`pwd`/./usr/lib/x86_64-linux-gnu epson-printer-utility
答案4
我未使用 PPA 就修复了这个问题。
我从 repo 下载了三个包bionic
:
libqtcore4_4.8.7+dfsg-7ubuntu1_amd64.deb
libqtgui4_4.8.7+dfsg-7ubuntu1_amd64.deb
libaudio2_1.9.4-6_amd64.deb
并使用档案管理器提取这些文件:
libQtCore.so.4
libQ4Core.so.4.8.7
libQtGui.so.4
libQtGui.so.4.8.7
libaudio.so.2
然后将全部 5 个文件复制到/usr/lib/x86_64-linux-gnu