简体   繁体   English

将 cx_freeze 与 feedparser 导入一起使用时出错:ModuleNotFoundError: No module named 'sgmllib'

[英]Error using cx_freeze with a feedparser import: ModuleNotFoundError: No module named 'sgmllib'

I am trying to use cx_freeze to freeze an app that uses Feedparser.我正在尝试使用 cx_freeze 冻结使用 Feedparser 的应用程序。 The app works perfectly if I launch it from the command line using python.如果我使用 python 从命令行启动该应用程序,它可以完美运行。 However, when I try to freeze it using cx_freeze, I don't get an error until I try to launch the app.但是,当我尝试使用 cx_freeze 冻结它时,在尝试启动应用程序之前我不会收到错误消息。 Then I get:然后我得到:

Traceback (most recent call last):
  File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 66, in run
    module.run()
  File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/Console.py", line 36, in run
    exec(code, m.__dict__)
  File "main.py", line 8, in <module>
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/__init__.py", line 28, in <module>
    from .api import parse
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/api.py", line 36, in <module>
    from .html import _BaseHTMLProcessor
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/html.py", line 31, in <module>
    from .sgml import *
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/sgml.py", line 30, in <module>
    import sgmllib
ModuleNotFoundError: No module named 'sgmllib'

I know sgmllib is no longer used in Python 3, but since I don't get this error when I launch it from the command line it doesn't seem to be a feedparser issue.我知道 sgmllib 不再在 Python 3 中使用,但是由于我从命令行启动它时没有收到此错误,因此这似乎不是 feedparser 问题。 Any thoughts?有什么想法吗?

The cx_Freeze developer helped me with this same issue on Github. cx_Freeze 开发人员在 Github 上帮助我解决了同样的问题。 Here's the thread.这是线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM