我正在尝试尝试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"
如何解决这个问题(除了从源头中删除这些检查)?