2017-10-04 69 views
1

我想將我的項目編譯爲.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程序,我得到這個錯誤:

Error

這似乎在某種程度上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 

回答

1

這是我通常如何得到numpy的我cx_freeze應用工作

addtional_mods = ['numpy.core._methods', 'numpy.lib.format'] 

packages = ["numpy"] 
options = { 
    'build_exe': { 



     'includes': addtional_mods, 
     'packages':packages, 
    }, 

}