【发布时间】:2015-06-13 10:11:31
【问题描述】:
我想从我的使用“pyautoit”模块的 Windows 应用程序创建一个 cx_freeze 可执行文件。
pip install -U pyautoit
这是我的示例代码:
main.py
import autoit
autoit.run("notepad.exe")
autoit.win_wait_active("[CLASS:Notepad]", 3)
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
autoit.win_close("[CLASS:Notepad]")
autoit.control_click("[Class:#32770]", "Button2")
setup.py
import sys
from cx_Freeze import setup, Executable
build_exe_options = {
"packages": ["autoit"],
"excludes": []
}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "AutoItSample",
version = "0.1",
description = "Automate Notepad Editor",
options = {"build_exe": build_exe_options},
executables = [Executable("main.py", base=base)],
)
我在我的项目文件夹中使用此命令创建了构建。
python setup.py build
此模块使用模块文件夹中包含的 .dll 文件。
autoit
lib
AutoItX3.dll
autoit.py
...
但是 cx_freeze 不包括 library.zip 存档中的这个 .dll。
我尝试在 library.zip 存档中手动包含 lib 文件夹。
但是我遇到了同样的错误。
http://pix.toile-libre.org/upload/original/1428496271.png
我应该怎么做才能让它工作?
【问题讨论】:
标签: python windows autoit cx-freeze