pyInstaller AttributeError: module nbt has no attribute world

2024-09-29 01:35:19 发布

您现在位置:Python中文网/ 问答频道 /正文

当尝试运行pyInstaller打包的脚本时,我得到
AttributeError: module 'nbt' has no attribute 'world'
在第1行,它是from nbt import nbt。在

这在Linux和Windows上都会发生。
我尝试了不同的导入,比如from nbt.nbt import NBTFile或{}。
如果我注释掉这一行,其他的导入都会正常工作,脚本只有在到达使用此导入的第一行之后才会停止。在

使用pyinstaller [name].py -F -d打包后运行脚本时的调试消息没有帮助。文档也没有帮助。在

有什么线索可以说明是什么引起的吗?在

使用:
Python 3.5
pyInstaller 3.2.1
NBT 1.4.1


Tags: nofromimport脚本worldlinuxwindowsattribute
1条回答
网友
1楼 · 发布于 2024-09-29 01:35:19

似乎您找到了PyInstaller无法识别的导入。您应该帮助PyInstaller查找带有.spec filehooks的模块-请参阅example,使用外部模块或直接使用hidden import查找模块。在

我成功地用命令行pyinstaller hidden-import nbt.world script.py构建了一个工作发行版。在

相关问题 更多 >