我用 pyinstaller 制作了可执行文件,如下所示(没有 --onefile 或其他选项)
> pyinstaller brdg2.py
当我运行它时,here's what i get (命令提示符关闭前的屏幕截图)。
从其他线程来看,开始时的警告似乎可以忽略,所以问题是
ImportError: No module named htmlentitydefs
编辑:我得到the same ImportError 使用 cx_freeze 创建的 .exe,因此它似乎与打包程序无关。
还要添加一些信息,我刚刚重新安装了 Python 和必要的模块,并且之前执行相同操作时没有收到此错误(不过我确实收到了其他错误)。
最佳答案
在 Python 3 中,htmlentitydefs 模块已重命名为 html.entities。在将源代码转换为 Python 3 时,2to3 工具将自动调整导入。
使用html.entities
而不是htmlentitydefs
关于python - Py安装程序: “ImportError: No module named htmlentitydefs”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20903245/