【发布时间】:2014-04-14 11:06:39
【问题描述】:
我正在尝试尝试django-easy-pdf,但我在安装依赖项时遇到问题。
我在运行 Django 时得到ImportError: No module named xhtml2pdf.default。
为了尝试修复,我执行了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"
如何解决这个问题(除了从源中删除这些检查)?
【问题讨论】:
标签: python django reportlab xhtml2pdf