Reportlab找不到使用产品的\u映像模块

2024-03-29 13:23:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图将django应用程序推送到生产服务器,但由于某些原因,它失败了,并说:

ImportError: The _imaging C module is not installed

奇怪的是,当我在同一台机器上使用开发服务器时,它工作得很好。PIL已经安装好了,我可以在shell中手工导入成像模块。生产服务器使用Apache。有什么想法吗?在

Traceback (most recent call last):

File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs)

File "C:/portal2\compliance\views.py", line 91, in show_statement doc.build(Story, onFirstPage=firstPage, onLaterPages=otherPage)

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 1117, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 877, in build self.clean_hanging()

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 510, in clean_hanging self.handle_flowable(self._hanging)

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 757, in handle_flowable f.apply(self)

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 140, in apply getattr(doc,arn)(*args)

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 1093, in handle_pageBegin self._handle_pageBegin()

File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 535, in handle_pageBegin self.pageTemplate.onPage(self.canv,self)

File "C:/portal2\compliance\views.py", line 55, in firstPage canvas.drawImage(img,0,0,8.5*inch,11*inch)

File "C:\Python27\lib\site-packages\reportlab\pdfgen\canvas.py", line 857, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)

File "C:\Python27\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 2094, in init self.loadImageFromA85(src)

File "C:\Python27\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 2100, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG))

File "C:\Python27\lib\site-packages\reportlab\pdfbase\pdfutils.py", line 34, in makeA85Image raw = img.getRGBData()

File "C:\Python27\lib\site-packages\reportlab\lib\utils.py", line 658, in getRGBData annotateException('\nidentity=%s'%self.identity())

File "C:\Python27\lib\site-packages\reportlab\lib\utils.py", line 655, in getRGBData self._data = im.tostring()

File "C:\Python27\lib\site-packages\PIL\Image.py", line 532, in tostring self.load()

File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 164, in load self.load_prepare()

File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 231, in load_prepare self.im = Image.core.new(self.mode, self.size)

File "C:\Python27\lib\site-packages\PIL\Image.py", line 37, in getattr raise ImportError("The _imaging C module is not installed")

ImportError: The _imaging C module is not installed identity=[ImageReader@0x4517a30 filename='C:\portal2\pdf\Certification_fullframe.tif'] handle_pageBegin args=()


Tags: inpybuildselfpillibpackagesline
2条回答

PIL应该在使用它的库之前安装。我也遇到了类似的问题libimaging-在libimaging之前没有安装PIL,所以libimaging是在没有安装PIL的情况下编译的。解决方案是卸载libimaging并在系统中已经存在PIL的情况下重新安装它。在

找到答案了!在

Trouble using PIL in Django app on Windows

我必须安装一个PIL版本,它是预先编译好的,可以与mod wsgi一起使用。在

相关问题 更多 >