cx_freeze将项目构建为.exe文件,获取numpy导入错误
问题描述:
我想将我的项目编译为.exe文件。cx_freeze将项目构建为.exe文件,获取numpy导入错误
我已经浏览过互联网,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)])
它建立得很好用:蟒蛇的setup.py建立
但是当我尝试运行我的.exe程序,我得到这个错误:
这似乎在某种程度上numpy的有关系,但无法弄清楚如何解决它......我安装和卸载numpy的,但遗憾的是没有运气。
从CMD运行“蟒蛇”我的输出,是如下:
Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:25:24)
[MSC v.1900 64 bit (AMD64)] on win32
答
这是我通常如何得到numpy的我cx_freeze应用工作
addtional_mods = ['numpy.core._methods', 'numpy.lib.format']
packages = ["numpy"]
options = {
'build_exe': {
'includes': addtional_mods,
'packages':packages,
},
}