2010-04-06 22 views
10

Soy bastante nuevo en Mac OS X. cuando intenté instalar PyQt en Mac Os X después de instalar Python 3.1, Qt 4.6.2 y SIP 4.10.1 me encuentro con el siguiente error cuando ejecuto el comando $ python3 configure.py.Cómo instalar PyQt en Mac OS X 10.6

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. 

alguien aquí instalado PyQt en Mac OS X 10.6.2 con éxito?

Respuesta

6

Tuve el mismo problema que tuviste. La solución es bastante simple.

Debido a un error en configure.py de PyQt4, no debe tener un carácter de espacio en la ruta del directorio de origen de PyQt4. El error se debe a una sintaxis incorrecta cuando configure.py invoca el ejecutable sip en una ruta de entrada con espacios.

+1

¿Cómo lo resuelves? –

+0

Simple, solo copie la carpeta de archivos fuente PyQt4 (la carpeta llamada algo así como PyQt-mac-gpl-4.xx.x) en el Escritorio e inténtelo de nuevo. –

8

QT y PyQt también disponible para instalar en OSX usando Homebrew

+0

He intentado instalar a través de pip y easy_install, pero ambos paquetes tienen problemas para instalar. Me acabas de salvar de tener que averiguar fallas y dependencias de segmentación – pocketfullofcheese

0

dado que está utilizando PyQt v4.7 necesita instalar Qt v4.7 también, seguir adelante e instalar Qt v4.7.1 primero.

+0

no es así – AbiusX

4

Tuve este problema y, de hecho, mi carpeta fuente PyQt estaba en un directorio que tenía un carácter de espacio en algún lugar de la ruta.

Pude hacer esto moviendo la carpeta de origen de PyQt a la raíz y ejecutando python configure.py desde allí.

1

También puede usar PyQtX, que es una distribución binaria de PyQt para OS X y también incluye bibliotecas Qt. Solo necesitas Python para eso.

+1

Esto no funciona con OS X 10.8, se queja de no tener Python 2.7 de la distribución oficial. Eso es ridículo teniendo en cuenta que el pitón de facto es el que funciona con el sistema operativo. – sorin

+0

Si lee los requisitos antes de la instalación, indica claramente que necesita instalar Python desde una distribución de Python.org, y no la que viene con Mac OS X. – AbiusX

+1

Esta debería ser la respuesta correcta, es la solución más fácil si no usas una versión brew de python. – Jim

32

Intente utilizar brebaje:

brew install pyqt 

Se recomienda que los más altamente macports ahora.

+3

¡Advertencia! Esto funciona solo si está utilizando el python de brew y no el que se distribuye con OS X. Por lo tanto, si el primer python en PATH es el OS X one, no funcionará. – sorin

+1

... pero puede agregar la ruta de PyQt a su 'PYTHONPATH'. De hecho, Homebrew le dará la ruta que necesitará exportar, algo similar a 'exportar PYTHONPATH =/usr/local/lib/python2.7/site-packages: $ PYTHONPATH'. Ponlo en tu archivo '~/.bashrc' y deberías ir. –