2010-04-06 18 views
10

Sono abbastanza nuovo su Mac OS X. quando ho provato a installare PyQt su Mac Os X dopo aver installato python 3.1, Qt 4.6.2 e SIP 4.10.1 ho incontrato il seguente errore quando eseguo $ python3 configure.py comando.Come installare PyQt su 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. 

Qualcuno ha installato con successo PyQt su Mac OS X 10.6.2?

risposta

6

Ho avuto lo stesso problema che avevi. La soluzione è piuttosto semplice.

A causa di un bug in configure.py di PyQt4, non si suppone di avere un carattere di spazio nel percorso della directory di origine PyQt4. L'errore è dovuto a una sintassi errata quando configure.py richiama sip eseguibile su un percorso di input con spazi.

+1

Come lo risolvete? –

+0

Semplice, copia la cartella dei file sorgente PyQt4 (la cartella chiama qualcosa come PyQt-mac-gpl-4.xx.x) sul desktop e riprova. –

8

QT e PyQT anche disponibile per l'installazione su OSX utilizzando Homebrew

+0

Ho provato a installare tramite pip e easy_install, ma entrambi i pacchetti hanno problemi di installazione. Mi hai appena salvato dal dover calcolare i difetti di segmentazione e le dipendenze – pocketfullofcheese

0

Dal momento che si sta utilizzando PyQt v4.7 è necessario installare Qt v4.7 troppo, andare avanti ed installare Qt v4.7.1 prima.

+0

no, non è così – AbiusX

4

Ho avuto questo problema, e in effetti la mia cartella PyQt era in una directory che aveva un carattere spaziale da qualche parte nel percorso.

Sono riuscito a farlo funzionare spostando la cartella PyQt sorgente nella root e eseguendo python configure.py da lì.

1

È inoltre possibile utilizzare PyQtX, che è una distribuzione binaria di PyQt per OS X e include anche librerie Qt. Hai solo bisogno di Python per questo.

+1

Questo non funziona con OS X 10.8, si lamenta di non avere Python 2.7 dalla distribuzione ufficiale. Questo è ridicolo considerando che il defacto python è quello che si avvicina al sistema operativo. – sorin

+0

Se leggi i requisiti prima dell'installazione, indica chiaramente che devi installare Python da una distribuzione Python.org, e non quella fornita con Mac OS X. – AbiusX

+1

Questa dovrebbe essere la risposta corretta, è la soluzione più semplice se non usi una versione brew di Python. – Jim

32

Provare a utilizzare birra:

brew install pyqt 

è più altamente raccomandato di macports ora.

+3

Attenzione! Funziona solo se stai usando Python da brew e non quello distribuito con OS X. Quindi se il primo python in PATH è OS X, non funzionerà. – sorin

+1

... ma puoi aggiungere il percorso di PyQt al tuo 'PYTHONPATH'. Infatti, Homebrew ti darà il percorso che dovrai esportare, qualcosa sulla falsariga dell'esportazione di PYTHONPATH =/usr/local/lib/python2.7/site-packages: $ PYTHONPATH'. Mettilo nel tuo file '~/.bashrc' e dovresti essere bravo a farlo. –

Problemi correlati