Как установить PyQt на Mac OS X 10.6

Я новичок в Mac OS X. Когда я пытался установить PyQt на Mac Os X после установки python 3.1, Qt 4.6.2 и SIP 4.10.1, я столкнулся со следующей ошибкой при выполнении команды $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.

Кто-нибудь успешно установил PyQt на Mac OS X 10.6.2?


person Jeba    schedule 06.04.2010    source источник


Ответы (6)


Попробуйте использовать пиво:

brew install pyqt

Сейчас это более настоятельно рекомендуется, чем macports.

person th3morg    schedule 27.10.2012
comment
Предупреждение! Это работает только в том случае, если вы используете python из brew, а не тот, который распространяется с OS X. Поэтому, если первым python в PATH является OS X, он не будет работать. - person sorin; 12.07.2013
comment
... но вы можете добавить путь к PyQt в свой PYTHONPATH. Фактически, Homebrew предоставит вам путь, который вам нужно будет экспортировать, что-то вроде export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH. Поместите это в свой файл ~/.bashrc, и все будет хорошо. - person Stefan van den Akker; 20.10.2014

QT и PyQT также доступны для установки на OSX с помощью Homebrew.

person PhoebeB    schedule 31.12.2010
comment
Я продолжал пытаться установить через pip и easy_install, но у обоих этих пакетов есть проблемы с установкой. Вы только что избавили меня от необходимости разбираться в ошибках и зависимостях сегментации. - person pocketfullofcheese; 13.01.2013

У меня была та же проблема, что и у вас. Решение довольно простое.

Из-за ошибки в configure.py PyQt4 у вас не должно быть пробела в пути к исходному каталогу PyQt4. Ошибка возникает из-за неправильного синтаксиса, когда configure.py вызывает исполняемый файл sip на входном пути с пробелами.

person Kevin    schedule 16.10.2010
comment
Просто скопируйте папку с исходными файлами PyQt4 (папка с названием PyQt-mac-gpl-4.xx.x) на рабочий стол и повторите попытку. - person Gerardo Contijoch; 10.09.2013

У меня была эта проблема, и действительно, моя исходная папка PyQt находилась в каталоге, где где-то в пути был символ пробела.

Я смог выполнить эту работу, переместив исходную папку PyQt в корень и запустив оттуда python configure.py.

person Mike Cavaliere    schedule 05.01.2011

Вы также можете использовать PyQtX, который является бинарным дистрибутивом PyQt для OS X и также включает Qt. библиотеки. Вам просто нужен Python для этого.

person Community    schedule 28.06.2012
comment
Это не работает с OS X 10.8, жалуется на отсутствие Python 2.7 из официального дистрибутива. Это нелепо, учитывая, что де-факто python — это тот, который поставляется с ОС. - person sorin; 12.07.2013
comment
Если вы прочитали требования перед установкой, то там четко указано, что вам нужно установить Python из дистрибутива Python.org, а не из того, который поставляется с Mac OS X. - person AbiusX; 22.09.2013
comment
Это должен быть правильный ответ, это самое простое решение, если вы не используете варочную версию Python. - person Jim; 24.02.2014

Поскольку вы используете PyQt v4.7, вам также необходимо установить Qt v4.7, сначала установите Qt v4.7.1.

person ismail    schedule 31.12.2010