gpt4 book ai didi

python - 打开由 cx_freeze 构建的 exe 文件时出错

转载 作者:太空宇宙 更新时间:2023-11-04 03:37:05 24 4
gpt4 key购买 nike

我使用 PyQt5、matplotlib、numpy、scipy、nmrglue 编写了一个程序,并设法使用 cx_freeze 将其构建到 exe 文件中。

这是我的 setup.py:

from cx_Freeze import setup, Executable

setup(name= 'NmrAnalysis',
version = '1.0',
description = 'Analysis System by iceorange',
executables = [Executable('MainWindow.py')])

当我执行MainWindow.exe时,它说:

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.

当我在 Dependency Walker 中运行它时,它说: enter image description here如何解决这个问题呢?非常感谢!

最佳答案

我终于成功让它工作了。

我在这里写了一篇维基笔记: https://github.com/lianxiangru/NMR-Analysis-UI/wiki/Notes

Py2exe 也可以使用类似的过程。

关于python - 打开由 cx_freeze 构建的 exe 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28544813/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com