erv*_*gsb 5 python freeze cx-freeze
我正在尝试使用cx-freeze来创建我的应用程序的静态自包含分发(The Spye Python Engine,www.spye.dk),但是,当我运行cx-freeze时,它说:
Missing modules:
? _md5 imported from hashlib
? _scproxy imported from urllib
? _sha imported from hashlib
? _sha256 imported from hashlib
? _sha512 imported from hashlib
? _subprocess imported from subprocess
? configparser imported from apport.fileutils
? usercustomize imported from site
Run Code Online (Sandbox Code Playgroud)
这是我的setup.py:
#!/usr/bin/env python
from cx_Freeze import setup, Executable
includes = ["hashlib", "urllib", "subprocess", "fileutils", "site"]
includes += ["BaseHTTPServer", "cgi", "cgitb", "fcntl", "getopt", "httplib", "inspect", "json", "math", "operator", "os", "os,", "psycopg2", "re", "smtplib", "socket", "SocketServer", "spye", "spye.config", "spye.config.file", "spye.config.merge", "spye.config.section", "spye.editor", "spye.framework", "spye.frontend", "spye.frontend.cgi", "spye.frontend.http", "spye.input", "spye.output", "spye.output.console", "spye.output.stdout", "spye.pluginsystem", "spye.presentation", "spye.util.html", "spye.util.rpc", "ssl", "stat,", "struct", "subprocess", "sys", "termios", "time", "traceback", "tty", "urllib2", "urlparse", "uuid"]
includefiles=[]
excludes = []
packages = []
target = Executable(
# what to build
script = "spye-exe",
initScript = None,
#base = 'Win32GUI',
targetDir = r"dist",
targetName = "spye.exe",
compress = True,
copyDependentFiles = True,
appendScriptToExe = False,
appendScriptToLibrary = False,
icon = None
)
setup(
version = "0.1",
description = "No Description",
author = "No Author",
name = "cx_Freeze Sample File",
options = {"build_exe": {"includes": includes,
"excludes": excludes,
"packages": packages
#"path": path
}
},
executables = [target]
)
Run Code Online (Sandbox Code Playgroud)
请注意,我在包含列表中明确指出了缺少的模块.
我该如何解决?
Ber*_*nnF -1
我想,你不能简单地+=列出清单。
您可能应该使用 list 方法extend- 否则原始列表将不会被修改:
includes.extend(["BaseHTTPServer", "<rest of your modules>"])
Run Code Online (Sandbox Code Playgroud)
编辑:(感谢@ThomasK)
+=工作正常 - 我只有一个无法正常工作的在线 Python 解释器。(我的 Windows 安装上没有安装 python,所以我必须在线检查)。
| 归档时间: |
|
| 查看次数: |
4495 次 |
| 最近记录: |