如何在 Mac OS X 10.6 上安装 PyQt
我对 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 吗?
I'm quite new to Mac OS X.
when i tried to install PyQt on Mac Os X after installing python 3.1, Qt 4.6.2 and SIP 4.10.1 i encounter the following error when i execute $python3 configure.py command.
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.
Anybody here installed PyQt on Mac OS X 10.6.2 successfully?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试使用brew:
现在比macports更推荐。
Try using brew:
It is more highly recommended than macports now.
QT 和 PyQT 也可以使用 Homebrew 安装在 OSX 上
QT and PyQT also available to install on OSX using Homebrew
我和你有同样的问题。解决方案相当简单。
由于 PyQt4 的 configure.py 中的错误,您的 PyQt4 源目录路径中不应该有空格字符。该错误是由于 configure.py 在带有空格的输入路径上调用 sip 可执行文件时语法错误造成的。
I had the same problem as you had. The solution is rather simple.
Because of a bug in configure.py of PyQt4, you are not supposed to have a space character in your PyQt4 source directory path. The error is due to a wrong syntax when configure.py invokes sip executable on an input path with spaces.
我遇到了这个问题,实际上我的 PyQt 源文件夹位于路径中某处有空格字符的目录中。
我可以通过将 PyQt 源文件夹移动到根目录并从那里运行 python configure.py 来完成这项工作。
I had this problem, and indeed my PyQt source folder was in a directory which had a space character somewhere in the path.
I was able to make this work by moving the PyQt source folder to the root, and running python configure.py from there.
您还可以使用 PyQtX,它是适用于 OS X 的 PyQt 的二进制发行版,还包含 Qt图书馆。你只需要 Python 就可以了。
You can also use PyQtX, which is a binary distribution of PyQt for OS X and also includes Qt libraries. You just need Python for it.
由于您使用的是
PyQt v4.7
,您还需要安装Qt v4.7
,因此请先安装Qt v4.7.1
。Since you are using
PyQt v4.7
you need to installQt v4.7
too, go ahead and installQt v4.7.1
first.