当尝试运行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
似乎您找到了PyInstaller无法识别的导入。您应该帮助PyInstaller查找带有.spec file或hooks的模块-请参阅example,使用外部模块或直接使用hidden import查找模块。在
我成功地用命令行
pyinstaller hidden-import nbt.world script.py
构建了一个工作发行版。在相关问题 更多 >
编程相关推荐