[PYTHON] Put PySide + PyInstaller-> empty qt.conf on Mac

Note that I got stuck when exeizing a Python program using PySide on Mac. Since Python is a scripting language that makes full use of a huge library, it has the advantage of explosive coding, but when passing a program to another person, the script (group) that I wrote + the Python interpreter itself + the dependent libraries are put together. The work of making one executable (essentially exe) (sometimes called freeze) is essential.

There are various tools in the world that convert Python scripts into exes, and PyInstaller is the simplest among them, borrowing around the tag of V2.1 from github, the following If you call it like this, dist / hoge (.exe) can be created in an instant.

python pyinstaller/pyinstaller.py --onefile hoge.py

Fits with Qt

Now, let's take a look at the Qt Python bindings PyQt and PySide. When converting the used script (group) to exe, it will not start in one shot. When I tried to exe the script using PySide on Mac 10.9 this time, the exe conversion itself by pyinstaller.py passed in one shot, but when I tried to execute it, the following error was laughable It came out and was in a state of falling easily. In short, it seems that I am in trouble because I do not know which to read, Qt that is originally included in Mac.

objc[20102]: Class QCocoaWindow is implemented in both /var/folders/qk/z4x58g2962q21q5570g2hj0c0000gn/T/_MEIftohUI/QtGui and /Library/Frameworks/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.

On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.

touch dist/qt.conf So, the workaround that I finally arrived at after collecting various information is to put an empty file called qt.conf next to the exe. Here Although it is information, I could not find it anywhere else for the problem with high encounter rate. It's a record for those who get stuck in the same thing.

Recommended Posts

Put PySide + PyInstaller-> empty qt.conf on Mac
Put Anaconda on your Mac using Pyenv
Put Python's numerical calculation environment Anaconda on mac (2)
Put Python's numerical calculation environment Anaconda on mac
python on mac
Put Python 2.7.x on Mac OSX 10.15.5 with pyenv
Install Tensorflow on Mac
Install pyenv on mac
Pyenv + virtualenv on Mac
Install Ansible on Mac
Install Python on Mac
Install Python 3 on Mac
Install PySide2 on Ubuntu
numba installation on mac
Run OpenMVG on Mac
Install Python 3.4 on Mac
Install Caffe on Mac
Install mecab on mac
Install mecab-python on Mac
Try deepdream on Mac