I wrote a program using PyQt5, matplotlib, numpy, scipy, nmrglue and managed to build it into exe file with cx_freeze.
Here is my setup.py:
from cx_Freeze import setup, Executable
setup(name= 'NmrAnalysis',
version = '1.0',
description = 'Analysis System by iceorange',
executables = [Executable('MainWindow.py')])
When I execute MainWindow.exe, it says:
E:\PycharmProjects\NmrAnalysis\build\exe.win-amd64-3.4>MainWindow.exe > ../out.txt
Traceback (most recent call last):
File "D:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
File "MainWindow.py", line 5, in <module>
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "E:\PycharmProjects\NmrAnalysis\nmr_analysis.py", line 8, in <module>
import nmrglue as ng
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\nmrglue\__init__.py", line 1, in <module>
from .fileio import *
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\nmrglue\fileio\__init__.py", line 1, in <module>
from . import bruker
File "X:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
File "X:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\nmrglue\fileio\bruker.py", line 37, in <module>
from ..process import proc_base
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\nmrglue\process\__init__.py", line 1, in <module>
from . import proc_base
File "X:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
File "X:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\nmrglue\process\proc_base.py", line 11, in <module>
import scipy.signal
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\scipy\signal\__init__.py", line 264, in <module>
from .bsplines import *
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\scipy\signal\bsplines.py", line 4, in <module>
import scipy.special
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "D:\Python34\lib\site-packages\scipy\special\__init__.py", line 586, in <module>
from ._ufuncs import *
File "X:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "X:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "X:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "ExtensionLoader_scipy_special__ufuncs.py", line 22, in <module>
File "ExtensionLoader_scipy_special__ufuncs.py", line 14, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
When I run it in Dependency Walker, it says: How to solve this problem? Thanks a lot!
I finally successfully get it work.
I wrote a wiki note here: https://github.com/lianxiangru/NMR-Analysis-UI/wiki/Notes
Py2exe could also work with a similar procedure.