升级python成像库(PIL)时,它告诉我"JPEG支持不可用"

 jia19891213 发布于 2023-02-08 13:26

使用ubuntu 13.10,python 2.7.5:

>>> import _imaging, Image
>>> from PIL import Image, ImageDraw, ImageFilter, ImageFont
>>> im = Image.new('RGB', (300,300), 'white')
>>> draw = ImageDraw.Draw(im)
>>> font = ImageFont.truetype('arial.ttf', 14)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFont.py", line 218, in truetype
    return FreeTypeFont(filename, size, index, encoding)
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFont.py", line 134, in __init__
    self.font = core.getfont(file, size, index, encoding)
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFont.py", line 34, in __getattr__
    raise ImportError("The _imagingft C module is not installed")
**ImportError: The _imagingft C module is not installed**
>>>

那么为什么会这样呢?我该如何解决?我按照以下说明在本主题的底部找到了:

pip uninstall PIL
apt-get install libjpeg-dev
apt-get install libfreetype6-dev
apt-get install zlib1g-dev
apt-get install libpng12-dev
pip install PIL --upgrade

但在升级PIL时,看看我看到的内容:

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.5+ (default, Sep 19 2013, 13:48:49)
              [GCC 4.8.1]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------

这是正常对所有这些项目的支持不是可用?我该如何解决这个问题?

1 个回答
  • PIL基本上死了,叉子Pillow真的是你应该使用的.你需要通过它导入它

    from PIL import Image, ...
    

    它维护了所有功能PIL,并增加了很多功能,包括Python 3兼容性.此外,它正在积极开发中,与之不同PIL,因此您发现的任何错误实际上都有可能得到修复 - 与功能请求相同.

    您可以PIL通过运行来安装它(卸载后)

    pip install Pillow
    

    我相信Ubuntu有一个软件包,但我的VM目前让我头疼,我无法检查......

    2023-02-08 13:28 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有