2

我正在尝试让reportlabJython (2.5.2) 下运行,但无法安装:

$ easy_install reportlab

Searching for reportlab>=2.4
Reading http://pypi.python.org/simple/reportlab/
Reading http://www.reportlab.com/
Best match: reportlab 2.5
Downloading http://pypi.python.org/packages/source/r/reportlab/reportlab-2.5.tar.gz#md5=cdf8b87a6cf1501de1b0a8d341a217d3
Processing reportlab-2.5.tar.gz
Running reportlab-2.5/setup.py -q bdist_egg --dist-dir /var/folders/04/nrrmlfvx05l43fj6rljc2z400000gq/T/easy_install-x2cwzJ/reportlab-2.5/egg-dist-tmp-D_S74b
################################################
#Attempting install of _rl_accel, sgmlop & pyHnj
#extensions from '/private/var/folders/04/nrrmlfvx05l43fj6rljc2z400000gq/T/easy_install-x2cwzJ/reportlab-2.5/src/rl_addons/rl_accel'
################################################
################################################
#Attempting install of _renderPM
#extensions from '/private/var/folders/04/nrrmlfvx05l43fj6rljc2z400000gq/T/easy_install-x2cwzJ/reportlab-2.5/src/rl_addons/renderPM'
# installing without freetype no ttf, sorry!
# You need to install a static library version of the freetype2 software
# If you need truetype support in renderPM
# You may need to edit setup.cfg (win32)
# or edit this file to access the library if it is installed
################################################
Downloading standard T1 font curves
Finished download of standard T1 font curves
error: Setup script exited with error: Compiling extensions is not supported on Jython

setup.py尝试安装renderPM扩展时似乎会发生该错误。有没有办法在没有 renderPM 扩展的情况下安装 reportlab?

4

2 回答 2

2

我通过这样做来安装它(它甚至似乎可以工作):

curl -O http://pypi.python.org/packages/source/r/reportlab/reportlab-2.5.tar.gz
tar zxf reportlab-2.5.tar.gz
cd reportlab*
rm -rf src/rl_addons
jython setup.py install

基本上,这删除了本机扩展,设置似乎并不介意(尽管它会打印警告)。

于 2012-07-16T01:16:10.167 回答
0

Jython 不能使用任何需要 c 扩展的模块。

reportlab 先决条件页面

下载并安装相关版本的 Python Imaging Library

哎哟,PIL是 jython 的表演终结者。

你的选择是

  1. 使用其中一种 java pdf 解决方案,例如iText
  2. 使用任何 python 模板语言创建XLS-FO,然后使用Apache-FOP转换为 pdf

我在后者方面取得了很好的成功,因为无论您将来使用哪种语言,您学习的 XML 将始终是您的有效选择。

于 2012-07-15T17:05:34.670 回答