【问题标题】:Error using pip - module 'pip._vendor.html5lib' has no attribute 'parse'使用 pip 时出错 - 模块 'pip._vendor.html5lib' 没有属性 'parse'
【发布时间】:2017-10-16 09:09:07
【问题描述】:

今天尝试使用 pip 安装某些软件包时弹出此错误。 Python 版本 - 3.5.4

pip install pytesseract

它给出了以下例外:

Collecting pytesseractException:
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in ru
n
    wb.build(autobuilding=True)
  File "C:\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare
_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in _prepar
e_file
    require_hashes
  File "C:\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in pop
ulate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirem
ent
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_cand
idates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "C:\Anaconda3\lib\site-packages\pip\index.py", line 728, in __init__
    self.parsed = html5lib.parse(
AttributeError: module 'pip._vendor.html5lib' has no attribute 'parse'

即使对于 pip update 命令也会出现此异常。 html5lib 版本为 0.999。以下代码似乎运行良好。

import html5lib
document = html5lib.parse("<p>Hello World!")

任何关于为什么会出现此错误的指示都会有所帮助。提前致谢。

【问题讨论】:

  • 我在不同的包上遇到了同样的问题 - 并重新安装了 piphtml5lib 没有任何效果。作为一种解决方法,您可以尝试从源安装(或使用 Wheel 文件,如果有):git clone git@github.com:madmaze/pytesseract.gitpython setup.py install
  • 是的,我确实设法从源代码安装它。但是我的点子现在没用了。将重新安装并查看。

标签: python-3.x pip html5lib


【解决方案1】:

我正在使用 anaconda,最近更新了 conda 和 anaconda,我收到了这个错误。

'conda update pip' 修复了它

【讨论】:

  • 它现在似乎可以工作了。谢谢:) 我记得尝试过conda update anacondapython -m pip install --upgrade pip。那时候没搞定。谢谢:)
猜你喜欢
  • 2017-09-09
  • 2018-10-19
  • 1970-01-01
  • 2017-04-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-24
相关资源
最近更新 更多