python - 无法使用 tkinter 和 pytorch 模型制作 exe 文件
问题描述
我将 .spec 文件更改如下:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
excluded_modules = ['torch.distributions'] # add this
a = Analysis(['sample.py'],
pathex=['path'],
binaries=[],
datas=[],
hiddenimports=['pkg_resources.py2_warn'], # add this
hookspath=[],
runtime_hooks=[],
excludes=excluded_modules, # add this
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
然后运行:
pyinstaller -F sample.spec
然后我得到了这个错误:
笔记:
- 我从本地 .pth 文件加载 pytorch 模型。
解决方案
推荐阅读
- angular - Angular:试图让 ngx-pagination 工作
- r - 如何平均图函数并找到R中的置信带
- c# - Docker:使用 docker 和 netcore3.1 将文件写入物理或共享路径
- c++ - 为什么我不能从文本文件创建矢量对象?
- html - 在 if 块内部时,在单词 Jinja 之间的空格后强制换行
- google-apps-script - 用于发送电子邮件的 Google 表单脚本
- c# - Flurl Client - 是否可以从失败的请求中访问标头?
- sql - 按两个连接的列分组
- python - 如果新行使用python具有相同的主键,如何覆盖csv中的一行
- electron - 通过 package.json 从电子版本中排除文件