在cx_Freeze根据我的Python代码构建了一个可执行文件后,我遇到了以下错误。
C:\Users\MAIN\Desktop\NEW\build\exe.win-amd64-3.7>GUI-Peak-Analysis
Traceback (most recent call last):
File "C:\Users\MAIN\AppData\Local\Programs\Python\Python37\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
module.run()
File "C:\Users\MAIN\AppData\Local\Programs\Python\Python37\lib\site-packages\cx_Freeze\initscripts\Console.py", line 37, in run
exec(code, {'__name__': '__main__'})
File "GUI-Peak-Analysis.py", line 6, in <module>
File "C:\Users\MAIN\Desktop\NEW\Goldindec.py", line 11, in <module>
from scipy.interpolate import interp1d ## to smooth spectrum
File "C:\Users\MAIN\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\interpolate\__init__.py", line 167, in <module>
from .interpolate import *
File "C:\Users\MAIN\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\interpolate\interpolate.py", line 26, in <module>
from .interpnd import _ndim_coords_from_arrays
File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd
File "C:\Users\MAIN\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\spatial\__init__.py", line 100, in <module>
from .ckdtree import *
ModuleNotFoundError: No module named 'scipy.spatial.ckdtree'
我已经按照不同网站上的指示,包括cx_Freeze的FAQ来解决这个问题。我尝试从以下网站下载scipy模块https://github.com/scipy/scipy/releases(scipy-1.4.1.zip),并在用cx_Freeze构建程序时包括scipy.spatial.ckdtree模块。然而,当我浏览这个文件夹时,我只看到C和/或C++的源文件和头文件
Here is the code of my setup file:
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os", "astropy", "matplotlib", "numpy", "pyqt5", "scipy"],
"excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
#if sys.platform == "win32":
# base = "Win32GUI"
setup( name = "GUI-Peak-Analysis",
version = "0.1",
description = "My GUI application!",