Binary packages of PySide are available from developer.qt.nokia.com/wiki/PySideBinariesMacOSX. You only need to compile it yourself if you have explicit reason to.
However, if for any reason you would like to compile it yourself, read on. First of all, download Qt SDK. After it has been installed you can use this Makefile script to download, compile and package PySide from git master.
$ git clone git://gitorious.org/~lamikae/pyside/lamikae-pyside-packaging.git
$ cd lamikae-pyside-packaging/osx/
$ make package
$ cd lamikae-pyside-packaging/osx/
$ make package
Maybe after an hour or more you should have a .pkg file, which has PySide dynamically linked to Qt installed from official dmg.
Install it with the command:
$ sudo installer -pkg pyside-<version>.pkg -target "/"
See if it works (if there is no error, it does =) and try out some of the official PySide examples.
$ python -c "from PySide import QtCore"
You can inspect the package contents by
$ xar -xf pyside-<version>.pkg Bom && lsbom package.pkg/Bom
2 comments:
Thanks for the blog post, I want to use PySide on windows but having issues installing it.
I downloaded and installed the latest binaries from:
http://developer.qt.nokia.com/wiki/PySideBinariesWindows
But when I run your command line test:
python -c "from PySide import QtDeclarative"
I get "cannot import name QtDeclarative", it does not appear in the installed location either
C:\Python26\Lib\site-packages\PySide
QtCore does work, so I thought I would try and build the head from git.
Anyway followed some instructions online using CMake:
CMake pySide
however this does not appear to work as it returns errors:
-- QtCode NOT found. QtCore support disabled.
-- QtDeclarative NOT found. QtDeclarative support disabled. etc...
Any help would be great, I want to be able to use QtDeclarative.
Many Thanks,
J.
Somebody asked about PySide on Windows, and I accidentally removed the comment, sorry.
I have not tried to run PySide on Windows (yet), but if they build against Qt 4.6 it will not include QtDeclarative.
Qt 4.7 is just out and maybe there will be PySide Windows binaries for next release.
In the original question the PySide CMake did not find the Qt headers. Try to set the -DALTERNATIVE_QT_INCLUDE_DIR option.
I am using this CMake command to compile into sandbox:
cmake .. -DCMAKE_INSTALL_PREFIX=$(INSTALLDIR)/usr \
-DALTERNATIVE_QT_INCLUDE_DIR=/opt/local/libexec/qt4-mac-devel/include/ \
-DCMAKE_BUILD_TYPE=Debug \
-DQT_SRC_DIR=$(QT_SRC_DIR) \
-DSITE_PACKAGE=$(INSTALLDIR)/site-packages \
-DGENERATOR=$(INSTALLDIR)/usr/bin/shiboken && \
Post a Comment