Clo*_*ork 6 python tkinter python-imaging-library
可能重复:
img = Image.open(fp)AttributeError:class Image没有属性'open'
所以我试图用tkinter在python中查看图片.我安装了PIL并且我正在尝试打开图片但是我一直收到一个属性错误,说"类图像没有属性'打开'
from __future__ import division
from PIL import Image
from Tkinter import *
import random
img = Image.open("majestic creature.jpeg").convert("RGB")
Run Code Online (Sandbox Code Playgroud)
这不是我的所有代码,但这是程序似乎遇到麻烦的部分.
Ser*_*lis 11
从你所说的内容来看,即This is not all of the code.
您或其他一些导入已经声明了一些变量/类被调用Image,这已经覆盖了Image导入的类PIL.
要专门使用PIL Image类使用:
img = PIL.Image.open("majestic creature.jpeg").convert("RGB")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11183 次 |
| 最近记录: |