Error using pelican-quickstart “No module named html_parser”

纵饮孤独 提交于 2019-12-03 05:29:41

You may need to install six.

if you're using pip, try

pip install six

and then restart pelican-quickstart

Alexey Sviridov

Reinstall Pelican doesn't help me, so I made a little fix in pelican

Modifications were made in following file

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

at line 24 place

from six.moves import html_parser

instead of

from six.moves.html_parser import HTMLParser

and at line 299

    class _HTMLParser(html_parser.HTMLParser):

instead of

    class _HTMLParser(HTMLParser):

Modification actual for pelican 3.6.0, but seems to applicable for other version if search for this lines in readers.py file. This is just quick workaround, hope this problem will be solved at pelican's side.

This error seems to come from Python 2.7.6 on OSX. When I install python via Homebrew and reinstall this module I got rid of this error.

$ pip uninstall pelican
$ brew install python
$ which python # should show /usr/local/bin/python
$ python -V # should show Python 2.7.8
$ pip install pelican

I think that you've probably encountered with version conflict problem in module six.

Try sudo pip install virtualenv to create an isolate python environment.

start

  1. create your pelican path mkdir /path/to/pelican
  2. go to /path/to/pelican and create an isolate python environment with virtualenv venv
  3. activate virtualenv source venv/bin/activate
  4. install pelican under the venv(without sudo!) pip install pelican markdown

done

and now you are free to any problem mentioned above. all the dependencies in the venv are isolated from the global environment.

To quit the venv, type deactivate

I was running into the same error message.

six was also already installed, but an old version (1.4.1)

pip install six --upgrade

Installed six 1.10.0, which made pelican-quickstart finally work :)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!