【问题标题】:No module named poppler with python-poppler installed没有安装 python-poppler 的名为 poppler 的模块
【发布时间】:2017-02-02 21:09:05
【问题描述】:

请不要将其标记为重复,因为类似问题的解决方案对我不起作用

我的系统是ubuntu 16.04,我用的是python 2.7.12

我想要做的是使用 pdftohtml 将 pdf 文件转换为 html。看来我可以用 poppler 做到这一点。

我已经使用 sudo apt-get install 安装了 python-poppler,它似乎已安装:

dpkg -s python-poppler
Package: python-poppler
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 144
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 0.12.1-8.1
Provides: python2.7-poppler
Depends: libc6 (>= 2.4), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.8.0), libpoppler-glib8 (>= 0.18.0), python (>= 2.7), python (<< 2.8), python-gtk2 (>= 2.10.0), python-gobject (>= 2.10.1), python-cairo (>= 1.8.4)
Description: Poppler Python bindings
 This package includes Python bindings for LibPoppler.
 It is needed to run programs written in Python and using Poppler set.
 LibPoppler is a PDF rendering library based on xpdf PDF viewer, and used by
 kpdf and evince PDF viewers.
Original-Maintainer: Andrea Gasparini <gaspa@yattaweb.it>
Homepage: http://launchpad.net/poppler-python

但是,在 import poppler 上,它会引发导入错误。 我在这里错过了什么?

【问题讨论】:

  • 你能出示你的代码吗?
  • import poppler - 这实际上是我在脚本中编写的所有内容。也许我应该安装其他东西 - 另外或代替...
  • 你试过 pip install poppler 吗?
  • 没有可用的版本。此外,根据这个答案:stackoverflow.com/a/32157049/2843872 似乎过分了:(
  • 这就是您要找的东西吗? pypi.python.org/pypi/python-poppler-qt4

标签: python importerror poppler


【解决方案1】:

好的,问题是我的虚拟环境没有使用任何参数创建 - 所以 --no-site-packages 被用作默认值。 当我使用 mkvirtualenv --system-site-packages 重新创建它时,一切正常。

【讨论】:

  • 更好的解决方案是使用pip将poppler安装到虚拟环境中
猜你喜欢
  • 1970-01-01
  • 2021-09-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多