当前位置:  开发笔记 > 编程语言 > 正文

如何在Mac OS X 10.6上安装PyQt

如何解决《如何在MacOSX10.6上安装PyQt》经验,为你挑选了3个好方法。

我是Mac OS X的新手.当我在安装python 3.1,Qt 4.6.2和SIP 4.10.1后尝试在Mac OS X上安装PyQt时,我执行$ python3 configure.py命令时会遇到以下错误.

Determining the layout of your Qt installation...
This is the GPL version of PyQt 4.7 (licensed under the GNU General Public
License) for Python 3.1 on darwin.

Type '2' to view the GPL v2 license.
Type '3' to view the GPL v3 license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.

Do you accept the terms of the license? yes
Checking to see if the QtGui module should be built...
Checking to see if the QtHelp module should be built...
Checking to see if the QtMultimedia module should be built...
Checking to see if the QtNetwork module should be built...
Checking to see if the QtOpenGL module should be built...
Checking to see if the QtScript module should be built...
Checking to see if the QtScriptTools module should be built...
Checking to see if the QtSql module should be built...
Checking to see if the QtSvg module should be built...
Checking to see if the QtTest module should be built...
Checking to see if the QtWebKit module should be built...
Checking to see if the QtXml module should be built...
Checking to see if the QtXmlPatterns module should be built...
Checking to see if the phonon module should be built...
Checking to see if the QtAssistant module should be built...
Checking to see if the QtDesigner module should be built...
Qt v4.6.2 free edition is being used.
Qt is built as a framework.
SIP 4.10.1 is being used.
The Qt header files are in /usr/include.
The shared Qt libraries are in /Library/Frameworks.
The Qt binaries are in /Developer/Tools/Qt.
The Qt mkspecs directory is in /usr/local/Qt4.6.
These PyQt modules will be built: QtCore.
The PyQt Python package will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages.
PyQt is being built with generated docstrings.
PyQt is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/Developer/Applications/Qt/plugins/designer.
The PyQt .sip files will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/share/sip/PyQt4.
pyuic4, pyrcc4 and pylupdate4 will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/bin.
Generating the C++ source for the QtCore module...
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-z file] [file]
Error: Unable to create the C++ code.

有人在Mac OS X 10.6.2上成功安装了PyQt吗?



1> th3morg..:

尝试使用brew:

brew install pyqt

现在比macports更受推荐.


警告!这只适用于你使用brew中的python,而不是使用OS X分发的python.因此,如果PATH中的第一个python是OS X,那么它将无效.

2> PhoebeB..:

QT和PyQT也可以使用Homebrew在OSX上安装



3> 小智..:

我遇到了和你一样的问题.解决方案相当简单.

由于PyQt4的configure.py中存在错误,因此不应在PyQt4源目录路径中包含空格字符.当configure.py在带空格的输入路径上调用sip可执行文件时,错误是由于语法错误引起的.

推荐阅读
sx-March23
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有