【问题标题】:Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installedDjango-easy-pdf:需要 xhtml2pdf 报告 reportlab 2.2+,但安装了 3.0
【发布时间】: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


    【解决方案1】:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 2020-01-24
      • 1970-01-01
      • 2015-08-02
      • 2011-07-30
      • 1970-01-01
      • 2016-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多