Python cx_Freeze+Anaconda+import numpy生成大文件
我已经设法使用cx\U freeze 4.3.3将hello world py脚本制作成一个exe文件,但我想知道如何使构建更小? 我已经安装了Anaconda 3.7.1版、build 1.8.2版、python 2.7.8版,我的py脚本似乎严重依赖于Anaconda安装的模块和软件包。下面是一个简单的脚本:Python cx_Freeze+Anaconda+import numpy生成大文件,python,python-2.7,numpy,anaconda,Python,Python 2.7,Numpy,Anaconda,我已经设法使用cx\U freeze 4.3.3将hello world py脚本制作成一个exe文件,但我想知道如何使构建更小? 我已经安装了Anaconda 3.7.1版、build 1.8.2版、python 2.7.8版,我的py脚本似乎严重依赖于Anaconda安装的模块和软件包。下面是一个简单的脚本: from numpy import random print "hello world! " 使用cx_Freeze python setup.py build生成1027个文件,占
from numpy import random
print "hello world! "
使用cx_Freeze python setup.py build生成1027个文件,占用143MB磁盘空间。我想排除build_exe_选项中的大部分内容是一种方法,但那将是一个相当多的列表?我只是在导入中添加了numpy,因为这是我将来使用时需要的库以及scipy等,所以删除该库不是一个选项,即使它只在构建目录中安装了几个文件
My setup.py:
import sys
import os
from cx_Freeze import setup, Executable
pythonscript="hello.py"
build_exe_options = {
"path" : ["app"]+ sys.path,
"packages": [],
"excludes": ['tk','ttk','zmq','boto','tkinter','matplotlib'],
"includes": [],
"include_files": []}
setup( name = "helloworld",
version = "0.9",
options = {"build_exe": build_exe_options},
description = "Description of the app here.",
executables = [Executable("hello.py")]
)
可以看到python setup.py build的输出。用python编写病毒?开玩笑吧:是的,这就是numpy的作用