我安装了用于 Django 的使用xhtml2pdf
。pip
我收到以下 ImportError:
Reportlab Toolkit Version 2.2 or higher needed
但我有reportlab 3.0
>>> import reportlab
>>> print reportlab.Version
3.0
__init__.py
我在of中发现了这个 try catch 块xhtml2pdf
:
REQUIRED_INFO = """
****************************************************
IMPORT ERROR!
%s
****************************************************
The following Python packages are required for PISA:
- Reportlab Toolkit >= 2.2 <http://www.reportlab.org/>
- HTML5lib >= 0.11.1 <http://code.google.com/p/html5lib/>
Optional packages:
- pyPDF <http://pybrary.net/pyPdf/>
- PIL <http://www.pythonware.com/products/pil/>
""".lstrip()
log = logging.getLogger(__name__)
try:
from xhtml2pdf.util import REPORTLAB22
if not REPORTLAB22:
raise ImportError, "Reportlab Toolkit Version 2.2 or higher needed"
except ImportError, e:
import sys
sys.stderr.write(REQUIRED_INFO % e)
log.error(REQUIRED_INFO % e)
raise
中还有另一个错误util.py
:
if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
那不应该是这样的:
if not (reportlab.Version[:3] >="2.1"):
是什么赋予了?