ReportLab& Jython的?

时间:2012-07-15 06:37:26

标签: python jython reportlab

我正在尝试 reportlab Jython (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?

2 个答案:

答案 0 :(得分: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

基本上,这会删除原生扩展,设置似乎并不介意(但它会打印警告)。

答案 1 :(得分:0)

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

来自reportlab prerequisites page

  

为相关版本的

下载并安装Python Imaging Library

ouch,PIL是jython的表演终结者。

您的选择是

  1. 使用其中一个java pdf解决方案,例如iText
  2. 使用任何python模板语言创建XLS-FO,然后使用Apache-FOP转换为pdf
  3. 后者我取得了很大的成功,因为无论你将来使用什么语言,你学到的XML总是对你有用的选择。