{"id":10020915,"date":"2025-07-24T16:12:56","date_gmt":"2025-07-24T08:12:56","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020915"},"modified":"2025-07-24T16:12:56","modified_gmt":"2025-07-24T08:12:56","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88%e5%90%8c%e6%a0%b7%e6%98%af-lxml5-4-0%ef%bc%8c%e5%9c%a8-ubuntu%e4%b8%8a%e4%bc%9a%e6%8a%a5%e9%94%99-importerror-%e4%bd%86%e6%98%af-debian-%e4%b8%8d%e4%bc%9a%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020915","title":{"rendered":"\u4e3a\u4ec0\u4e48\u540c\u6837\u662f lxml5.4.0\uff0c\u5728 ubuntu\u4e0a\u4f1a\u62a5\u9519 ImportError \u4f46\u662f debian \u4e0d\u4f1a\u5462\uff1f"},"content":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u540c\u6837\u662f lxml5.4.0\uff0c\u5728 ubuntu\u4e0a\u4f1a\u62a5\u9519 ImportError: lxml.html.clean module is now a separate project lxml_html_clean \u4f46\u662f debian \u4e0d\u4f1a\u5462\uff1f<\/p>\n<p>\u6d4b\u8bd5\u7684 python \u90fd\u662f 3.11;lxml \u7248\u672c\u90fd\u662f 5.4\u30020<\/p>\n<p>\u673a\u5668 A Ubuntu 24.04.2 LTS x86_64<\/p>\n<pre><code class=\"shell\">In [1]: import lxml.html.clean\n---------------------------------------------------------------------------\nImportError                               Traceback (most recent call last)\nCell In[1], line 1\n----&gt; 1 import lxml.html.clean\n\nFile ~\/.local\/share\/virtualenvs\/parser-w55maLTU\/lib\/python3.10\/site-packages\/lxml\/html\/clean.py:18\n      8     __all__ = [\n      9         &quot;clean_html&quot;,\n     10         &quot;clean&quot;,\n   (...)\n     15         &quot;word_break_html&quot;,\n     16     ]\n     17 except ImportError:\n---&gt; 18     raise ImportError(\n     19         &quot;lxml.html.clean module is now a separate project lxml_html_clean.\/n&quot;\n     20         &quot;Install lxml[html_clean] or lxml_html_clean directly.&quot;\n     21     ) from None\n\nImportError: lxml.html.clean module is now a separate project lxml_html_clean.\nInstall lxml[html_clean] or lxml_html_clean directly.<\/code><\/pre>\n<p>\u673a\u5668 B Debian GNU\/Linux 12 (bookworm)<\/p>\n<pre><code class=\"shell\">In [1]: import lxml.html.clean<\/code><\/pre>\n<hr>\n<p>\u6700\u540e\u641e\u4e0d\u61c2\uff0c\u4f30\u8ba1\u662f\u4e00\u4e9b\u4f9d\u8d56\u6b8b\u7559\u7684\u95ee\u9898<\/p>\n<p>\u6240\u4ee5\u6211\u628a\u865a\u62df\u73af\u5883\u5220\u9664\u4e86\uff0c\u91cd\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff0c\u7136\u540e\u91cd\u65b0\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\uff0c\u95ee\u9898\u5c31\u6d88\u5931\u4e86<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000046875702\">https:\/\/segmentfault.com\/a\/1190000046875702<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u540c\u6837\u662f lxml5.4.0\uff0c\u5728 ubuntu\u4e0a\u4f1a\u62a5\u9519 ImportError: lxml.html.cl [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020915","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020915"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020915\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}