python3 PyQt / PySide Linux安装

时间:2012-07-17 09:53:50

标签: linux python-3.x installation pyqt4 pyside

我在Linux Mint上从源代码重新安装了python3.2.2解释器,在curses中添加了unicode支持,发现PyQt4库没有导入。我试图重新安装它,但遇到了与此问题相同的问题:PyQt4 for Python 3.2.2 failing to install on Linux Mint 12。所以我按照 BlaXpirit 的答案安装了PySide,但它也没有导入。然后我在 / usr / lib / python3 / dist-packages 中找到了它们,但未添加到PYTHONPATH变量中。我已经添加了dir并接下来收到了:

In [1]: import PySide

没关系,但是:

In [2]: import PySide.QtCore
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-1c10ffe6e7d7> in <module>()
----> 1 import PySide.QtCore

ImportError: No module named QtCore

和PyQt4:

In [3]: import PyQt4
In [4]: import PyQt4.QtCore
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-e7e95ffb1113> in <module>()
----> 1 import PyQt4.QtCore

ImportError: /usr/lib/python3/dist-packages/PyQt4/QtCore.so: undefined symbol:       PyUnicodeUCS4_AsLatin1String

在PySide目录中,内容是:

-rw-r--r-- 1 root root      181 2012-04-23 23:58 __init__.py
-rw-r--r-- 1 root root   783048 2012-04-24 02:16 phonon.cpython-32mu.so
drwxr-xr-x 2 root root     4096 2012-07-17 09:34 __pycache__
-rw-r--r-- 1 root root  2606568 2012-04-24 02:16 QtCore.cpython-32mu.so
-rw-r--r-- 1 root root   379188 2012-04-24 02:16 QtDeclarative.cpython-32mu.so
-rw-r--r-- 1 root root 11298296 2012-04-24 02:16 QtGui.cpython-32mu.so
-rw-r--r-- 1 root root   377804 2012-04-24 02:16 QtHelp.cpython-32mu.so
-rw-r--r-- 1 root root   921720 2012-04-24 02:16 QtNetwork.cpython-32mu.so
-rw-r--r-- 1 root root   370024 2012-04-24 02:16 QtOpenGL.cpython-32mu.so
-rw-r--r-- 1 root root   266296 2012-04-24 02:16 QtScript.cpython-32mu.so
-rw-r--r-- 1 root root    47608 2012-04-24 02:16 QtScriptTools.cpython-32mu.so
-rw-r--r-- 1 root root   481964 2012-04-24 02:16 QtSql.cpython-32mu.so
-rw-r--r-- 1 root root   152524 2012-04-24 02:16 QtSvg.cpython-32mu.so
-rw-r--r-- 1 root root    93592 2012-04-24 02:16 QtTest.cpython-32mu.so
-rw-r--r-- 1 root root   770644 2012-04-24 02:16 QtUiTools.cpython-32mu.so
-rw-r--r-- 1 root root   570536 2012-04-24 02:16 QtWebKit.cpython-32mu.so
-rw-r--r-- 1 root root   443944 2012-04-24 02:16 QtXml.cpython-32mu.so
-rw-r--r-- 1 root root   236552 2012-04-24 02:16 QtXmlPatterns.cpython-32mu.so

在PyQt4中:

-rw-r--r-- 1 root root    1111 2012-07-02 13:39 __init__.py
-rw-r--r-- 1 root root   13369 2012-07-02 13:39 pyqtconfig.py
-rwxr-xr-x 1 root root 2267672 2012-07-02 13:39 QtCore.so
-rwxr-xr-x 1 root root  226468 2012-07-02 13:39 QtDeclarative.so
-rwxr-xr-x 1 root root  302208 2012-07-02 13:39 QtDesigner.so
-rwxr-xr-x 1 root root 7362040 2012-07-02 13:39 QtGui.so
-rwxr-xr-x 1 root root  639832 2012-07-02 13:39 QtNetwork.so
-rwxr-xr-x 1 root root  248712 2012-07-02 13:39 QtOpenGL.so
-rwxr-xr-x 1 root root  187824 2012-07-02 13:39 QtScript.so
-rwxr-xr-x 1 root root   19964 2012-07-02 13:39 QtScriptTools.so
-rwxr-xr-x 1 root root    5508 2012-07-02 13:39 Qt.so
-rwxr-xr-x 1 root root  300872 2012-07-02 13:39 QtSql.so
-rwxr-xr-x 1 root root   85296 2012-07-02 13:39 QtSvg.so
-rwxr-xr-x 1 root root   28932 2012-07-02 13:39 QtTest.so
-rwxr-xr-x 1 root root  404432 2012-07-02 13:39 QtWebKit.so
-rwxr-xr-x 1 root root  158112 2012-07-02 13:39 QtXmlPatterns.so
-rwxr-xr-x 1 root root  301924 2012-07-02 13:39 QtXml.so
drwxr-xr-x 7 root root    4096 2012-07-02 13:39 uic

我已从存储库和python.org,源码和二进制文件中多次重新安装python3,现在我在 / usr / bin 中有1个可执行文件python3.2mu和 / usr / local / bin 中的3(python3,python3.2,python3.2m)。
请帮帮我!

1 个答案:

答案 0 :(得分:2)

通过改变pyatomic.h中的65行来解决PyQt4的问题:

 _Py_ANNOTATE_HAPPENS_BEFORE(address);

_Py_ANNOTATE_HAPPENS_BEFORE(address) (void)address;