首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AttributeError:模块'PIL.Image‘没有属性'VERSION’python2 pip

AttributeError:模块'PIL.Image‘没有属性'VERSION’python2 pip
EN

Ask Ubuntu用户
提问于 2020-04-25 15:22:35
回答 2查看 5.2K关注 0票数 3

当尝试运行肉桂设置python2时,我看到以下错误:

代码语言:javascript
复制
hutber@hutber:~$ cinnamon-settings python2
Traceback (most recent call last):
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 619, in <module>
    window = MainWindow()
  File "/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", line 247, in __init__
    for module in modules:
  File "/usr/share/cinnamon/cinnamon-settings/modules/cs_backgrounds.py", line 5, in <module>
    import imtools
  File "/usr/share/cinnamon/cinnamon-settings/bin/imtools.py", line 623, in <module>
    if Image.VERSION == '1.1.7':
AttributeError: module 'PIL.Image' has no attribute 'VERSION'

安装pip3 install streamdeck_ui --user install后,我看到了这个错误

EN

回答 2

Ask Ubuntu用户

发布于 2020-08-01 15:12:30

这是肉桂和pillow >= 6.0.0之间已知的版本控制问题。你可以找到更多的信息,这里。正如前面的一位评论者所说,您可以在/usr/share/cinnamon/cinnamon-settings/bin/imtools.py中找到错误。但是,将Image.VERSION更改为PIL.VERSION并不能解决pillow >= 7.0.0的问题。相反,必须将行更改为if Image.__version__ == '1.1.7':

票数 2
EN

Ask Ubuntu用户

发布于 2020-08-02 10:54:52

如果你对蟒蛇很满意的话。您可以修改/usr/share/cinnamon/cinnamon-settings/bin/imtools.py

  1. 备份文件。i.e
代码语言:javascript
复制
sudo cp /usr/share/cinnamon/cinnamon-settings/bin/imtools.py /usr/share/cinnamon/cinnamon-settings/bin/imtools.py.bk
  1. 用nano打开/usr/share/cinnamon/cinnamon-settings/bin/imtools.py
代码语言:javascript
复制
sudo nano /usr/share/cinnamon/cinnamon-settings/bin/imtools.py
  1. 删除第623至636行。并将637行移至645 4个空格向左移动。

在此之前:

代码语言:javascript
复制
if Image.VERSION == '1.1.7':

    def split(image):
        """Work around for bug in Pil 1.1.7

        :param image: input image
        :type image: PIL image object
        :returns: the different color bands of the image (eg R, G, B)
        :rtype: tuple
        """
        image.load()
        return image.split()
else:

    def split(image):
        """Work around for bug in Pil 1.1.7

        :param image: input image
        :type image: PIL image object
        :returns: the different color bands of the image (eg R, G, B)
        :rtype: tuple
        """
        return image.split()

之后:

代码语言:javascript
复制
def split(image):
    """Work around for bug in Pil 1.1.7

    :param image: input image
    :type image: PIL image object
    :returns: the different color bands of the image (eg R, G, B)
    :rtype: tuple
    """
    return image.split()

如果您使用的是PIL的当前版本,则不需要检查版本Image.VERSION 1.1.7。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1230923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档