Using Cx_freeze With PyQT5 And Python 3 On MacOSX
Solution 1:
So, after long fighting here is the issue: libzmq . I installed libzmq and specified the --qt-menu-nib option and the simple example above runs in both:
sudo python setup.py build
and
sudo python setup.py bdist_mac
Step by step instructions:
I used mac ports for most of my python33 packages so I sticked to it for the rest. Libzmq is not available on macports but its dependencies are. So:
1) install libtool, autoconf, automake:
sudo port install libtool
sudo port install autoconf
sudo port install automake
2) grab the latest version of libzmq from https://github.com/zeromq/libzmq ( I downloaded the ZIP for sake of order ) and unzip/navigate to the folder
/libzmq-master
now the instructions provided in the INSTALL document in the folder are pretty clear, if you installed all the dependencies then you will be fine. run:
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
3) download the latest cx_freeze from https://bitbucket.org/anthony_tuininga/cx_freeze/downloads then unzip/untar navigate to folder and run:
sudo python setup.py build
sudo python setup.py install
now when compiling code for MacOSX that uses Python3.3 and PyQt5 you can run:
sudo python setup.py build
then navigate in the build folder and run the program as:
./nameoftheprogram
once you made sure this work then build the app or dmg (as you prefer) with:
sudo python setup.py bdist_mac --qt-menu-nib=/Users/username/Qt5.2.1/5.2.1/clang_64/plugins/platforms/
where the path is the path to your Qt5 installation. If I don't use the --qt-menu-nib option the app crashes on startup whereas the build works fine.
Hope this will help someone in the future.
Solution 2:
I got the same error and recompiling with the latest version of ZMQ (4.0.4) did not solve the issue.
However, by looking in the messages of the /Applications/Utilities/Console.app
program, I could see that an extra command line option was given to my Python program. This command line option always started with -psn_0_
followed by a number. Apparently psn stands for Process Serial Number (see: http://hintsforums.macworld.com/showthread.php?t=11978).
My program uses the argparse
package to parse the command line arguments and exited with an error because it didn't recognized the -psn option. I now filter it out before parsing with argparse
and this solved my problem.
Post a Comment for "Using Cx_freeze With PyQT5 And Python 3 On MacOSX"