我正在尝试将项目编译为.exe文件。
我在网上看到cx_freeze是一个不错的选择。 所以我有这个setup.py脚本:
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["functions"], "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 = "Bacteria Data Analysis",
version = "0.1",
description = "This program analyses data from experiments",
options = {"build_exe": build_exe_options},
executables = [Executable("main.py", base=base)])
它使用:python setup.py build
构建得很好但是当我尝试运行我的.exe程序时,我收到了这个错误:
它似乎与numpy有关,但无法弄清楚如何解决它...我已经安装并卸载了numpy,但遗憾的是没有运气。
我在cmd中运行“python”的输出如下:
Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:25:24)
[MSC v.1900 64 bit (AMD64)] on win32
答案 0 :(得分:1)
这就是我通常使用我的cx_freeze应用程序
的方式addtional_mods = ['numpy.core._methods', 'numpy.lib.format']
packages = ["numpy"]
options = {
'build_exe': {
'includes': addtional_mods,
'packages':packages,
},
}