python-3.x - 使用 py2exe 编译时编译失败
问题描述
我使用此代码编译我的程序:
#Packages
from distutils.core import setup
import sys
import shutil
import os
sys.argv.append ("py2exe")#Auto call py2exe
if os.path.exists ("dist"):#Remove previous build
shutil.rmtree ("dist")
setup(
options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
windows = [{
"script" : "main.py",
"icon_resources" : [(0, "app.ico")]
}],
zipfile = None,
)
shutil.copy ("tool.exe", "dist/tool.exe")#Copy used tools
它工作了一段时间,但我在项目的其余部分工作时有一段时间没有使用它,但是当我尝试编译它时显示此错误:
C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'windows'
warnings.warn(msg)
C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'zipfile'
warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'py2exe'
我已经更新并重新安装了 python,以及 pip 和程序使用的所有库,但错误仍然存在。
解决方案
推荐阅读
- python-3.x - 如何将CSV文件解析成字典并一一使用(不使用CSV库)
- javascript - IOS ontouchstart 打不开文件对话框?
- ajax - FOSJsRouting Bundle“路由不存在”
- html - 在引导程序中实现卡顶部的按钮
- javascript - 猫鼬:人口众多
- python - 数据框中列上的 .map 的 NaN 错误
- javascript - javascript中回调函数的使用
- r - 如何测试方差不等的组之间多项式(线性)趋势的显着性?
- flutter - 在 null 上调用了 getter 'token'
- azure - 如何在具有 Microsoft Graph 高级权限的 Visual Studio 中本地使用托管服务标识回退到我的 Azure 凭据