我已经为我的tkinter GUI创建了一个可执行文件,但当尝试运行它时显示以下错误: numpy ImportError:cannot import name '_methods‘窗口上似乎有很多关于from.import_methods的信息。不知道为什么会这样,因为我还没有在项目中引入numpy。

我的setup.py代码是:
import sys
import os.path
from cx_Freeze import setup, Executable
#include_files = ['autorun.inf']
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
#os.environ['TCL_LIBRARY'] = r'C:\Users\DonikuY\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6'
#os.environ['TK_LIBRARY'] = r'C:\Users\DonikuY\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6'
executables = [
Executable('VacuumPumpGUI.py', base=base)
]
options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
},
}
setup(name="VacuumPumpGUI",
version="0.1",
description="Vacuum pump serial GUI.",
options=options,
executables=executables
)发布于 2018-01-09 03:59:05
这是cx_freeze中的known issue。
作为一种解决方法,您可以在构建选项中包括:
options = {
'build_exe': {
'includes':['atexit', 'numpy.core._methods', 'numpy.lib.format'],
}
}https://stackoverflow.com/questions/44549000
复制相似问题