gpt4 book ai didi

python-2.7 - 如何使用 python 2.7 在 Ubuntu 12.04 上安装 PyQt?

转载 作者:行者123 更新时间:2023-12-03 08:03:11 25 4
gpt4 key购买 nike

可能有一些类似的问题,如 this one ,但我没有找到任何适合我的答案。

我尝试了一些方法来做到这一点:
sudo aptitude install python-qt4-dev python-sip4 python-sip4-dev
来自:https://groups.google.com/forum/#!topic/mnemosyne-proj-devel/VQQzjhARWoA

我试过:
sudo aptitude install python-qt4
来自:http://www.saltycrane.com/blog/2008/01/how-to-install-pyqt4-on-ubuntu-linux/

每次上述安装后,我都会收到错误:

$python2.7
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4

我还尝试从源下载 PyQt4 安装它:
http://www.riverbankcomputing.co.uk/software/pyqt/download
啜饮: http://www.riverbankcomputing.co.uk/software/sip/download

然后我得到了安装 PyQt4 的错误提示:
$ sudo python configure.py --verbose
Determining the layout of your Qt installation...
/usr/bin/qmake -o qtdirs.mk qtdirs.pro
make -f qtdirs.mk
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -o qtdirs.o qtdirs.cpp
qtdirs.cpp:1:28: fatal error: QCoreApplication: No such file or directory
compilation terminated.
make: *** [qtdirs.o] Error 1
Error: Failed to determine the layout of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

我的问题是:在 Ubuntu 12.04 上安装 PyQt4 的正确有效方法是什么?

最佳答案

实际上,当您使用时,您确实为 Qt4 正确安装了 python 绑定(bind):

sudo aptitude install python-qt4

您通常应该使用发行版提供的软件包 - Ubuntu 提供的软件包完全可以满足您的需求。

令我困惑的是安装 Ubuntu 软件包后出现的错误。我刚刚在 Ubuntu 12.04 安装上试过这个,它对我有用。这表明你当前在系统上安装的 Ubuntu 在某种程度上被破坏了。

您可以尝试完全清除 python-qt4 包并重新安装它;
sudo apt-get remove --purge python-qt4

如果您还发出:
sudo apt-get clean

...这将从系统中删除所有下载的软件包文件,以便 apt 在您发出
sudo apt-get install python-qt4

如果 还是 不起作用,那么您的 Ubuntu 安装确实发生了一些非常奇怪的事情,完全重新安装 Ubuntu 可能是明智的。

关于python-2.7 - 如何使用 python 2.7 在 Ubuntu 12.04 上安装 PyQt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17240254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com