2

我正在尝试尝试django-easy-pdf,但在安装依赖项时遇到问题。

ImportError: No module named xhtml2pdf.default在运行 Django 时得到。

为了尝试修复,我做了一个pip install xhtml2pdf,但是产生了Could not find any downloads that satisfy the requirement pyPdf (from xhtml2pdf).

所以让我们pip install --allow-unverified pyPdf pyPdf来解决这个问题。这完成没有问题。重复 时pip install xhtml2pdf,软件安装没有问题。

但是,在启动 Django 1.6 时,我得到:ImportError: Reportlab Version 2.1+ is needed!.

我确实安装了 reportlab 2.2 或更高版本,因为pip freeze列出了 3.0。

看起来这是在几个文件(util.py__init__.py)中硬编码的:

if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
    raise ImportError("Reportlab Version 2.1+ is needed!")

if not REPORTLAB22:
    raise ImportError, "Reportlab Toolkit Version 2.2 or higher needed"

如何解决这个问题(除了从源头中删除这些检查)?

4

1 回答 1

5

作者在https://github.com/nigma/django-easy-pdf上提到:

django-easy-pdf depends on:
  django>=1.5.1
  git+https://github.com/chrisglass/xhtml2pdf.git

需要安装该特定版本,而不是 pypi 中可用的版本。首先使用 卸载 xhtml2pdf 和 pypdf pip uninstall,然后执行:

pip install git+https://github.com/chrisglass/xhtml2pdf.git

于 2014-04-14T11:06:39.150 回答