جانغو-سهل-pdf:مطلوب إصدار xhtml2pdf Reportlab 2.2+، ولكن تم تثبيت الإصدار 3.0

StackOverflow https://stackoverflow.com//questions/23058493

سؤال

أحاول أن أعطي django-easy-pdf خطوة، ولكن أواجه مشاكل في تثبيت التبعيات.

انا حصلت 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"

كيف يمكن إصلاح ذلك (باستثناء إزالة هذه الشيكات من المصدر)؟

هل كانت مفيدة؟

المحلول

يذكر المؤلف على 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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top