簡體   English   中英

PyInstaller:“導入錯誤:沒有名為 htmlentitydefs 的模塊”

[英]PyInstaller: “ImportError: No module named htmlentitydefs”

我用這樣的 pyinstaller 制作了可執行文件(沒有 --onefile 或其他選項)

> pyinstaller brdg2.py

當我運行它時,這是我得到的(命令提示符關閉前的屏幕截圖)。

從其他線程來看,開始時的警告似乎可以忽略,所以問題是

ImportError: No module named htmlentitydefs

編輯:我使用 cx_freeze 創建的 .exe 得到相同的ImportError ,所以它似乎與打包程序無關。

另外要添加一些信息,我剛剛重新安裝了 Python 和必要的模塊,並且之前在執行相同操作時沒有出現此錯誤(盡管我確實遇到了其他錯誤)。

htmlentitydefs 模塊已在 Python 3 中重命名為 html.entities。 2to3 工具將在將您的源代碼轉換為 Python 3 時自動調整導入。

使用html.entities而不是htmlentitydefs

https://docs.python.org/3/library/html.entities.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM