gpt4 book ai didi

python - 使用 pelican-quickstart "No module named html_parser"时出错

转载 作者:太空狗 更新时间:2023-10-29 17:17:33 24 4
gpt4 key购买 nike

我决定试试 pelican,但是当我运行 pelican-quickstart 时,我得到以下对话框:

$ pelican-quickstart
Traceback (most recent call last):
File "/usr/local/bin/pelican-quickstart", line 9, in <module>
load_entry_point('pelican==3.4.0', 'console_scripts', 'pelican-quickstart')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/__init__.py", line 20, in <module>
from pelican.generators import (ArticlesGenerator, PagesGenerator,
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/generators.py", line 23, in <module>
from pelican.readers import Readers
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/readers.py", line 24, in <module>
from six.moves.html_parser import HTMLParser
ImportError: No module named html_parser `

this post 中也有类似的错误信息,并且由于我在 OS X 10.10 (Yosemite) 上运行 Python 2.7.6,因此可能存在类似的问题。

解决这个问题的最佳方法是什么?

最佳答案

重新安装 Pelican 对我没有帮助,所以我在 pelican 中做了一些修复

在以下文件中进行了修改

/Library/Python/2.7/site-packages/pelican/readers.py

在第24行的地方

from six.moves import html_parser

代替

from six.moves.html_parser import HTMLParser

在第 299 行

    class _HTMLParser(html_parser.HTMLParser):

代替

    class _HTMLParser(HTMLParser):

pelican 3.6.0 的实际修改,但如果在 readers.py 文件中搜索此行,则似乎适用于其他版本。这只是快速解决方法,希望这个问题能在鹈鹕方面得到解决。

关于python - 使用 pelican-quickstart "No module named html_parser"时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26508606/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com