Python Anaconda无模块名_imagingtk
在前言中,我已经访问了,但这些都没有解决我的问题 我目前在eclipse环境中,正在我的项目中使用anaconda python解释器。我有一段代码:Python Anaconda无模块名_imagingtk,python,eclipse,python-imaging-library,anaconda,pillow,Python,Eclipse,Python Imaging Library,Anaconda,Pillow,在前言中,我已经访问了,但这些都没有解决我的问题 我目前在eclipse环境中,正在我的项目中使用anaconda python解释器。我有一段代码: from PIL import Image, ImageTk # other imports # .... # def initUI(self): pic1 = Image.open("pic1.jpg") pic1_img = ImageTk.PhotoImage(pic1) label1 = Label(self,
from PIL import Image, ImageTk
# other imports
# ....
# def initUI(self):
pic1 = Image.open("pic1.jpg")
pic1_img = ImageTk.PhotoImage(pic1)
label1 = Label(self, image=pic1_img)
label1.image = pic1_img
label1.place(x=20, y=20)
现在运行时,我得到这个输出
Traceback (most recent call last):
File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 46, in <module>
main()
File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 42, in main
app = Window(root)
File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 12, in __init__
self.initUI()
File "C:\Users\....\workspace\Tkinter_tutorial\absolutePositioning.py", line 22, in initUI
pic1_img = ImageTk.PhotoImage(pic1)
File "C:\Users\....\Anaconda\lib\site-packages\PIL\ImageTk.py", line 116, in __init__
self.paste(image)
File "C:\Users\....\Anaconda\lib\site-packages\PIL\ImageTk.py", line 181, in paste
import _imagingtk
ImportError: No module named _imagingtk
回溯(最近一次呼叫最后一次):
文件“C:\Users\…\workspace\Tkinter\u tutorial\absolutePositioning.py”,第46行,在
main()
文件“C:\Users\…\workspace\Tkinter\u tutorial\absolutePositioning.py”,主目录第42行
app=窗口(根)
文件“C:\Users\…\workspace\Tkinter\u tutorial\absolutePositioning.py”,第12行,在\uuuu init中__
self.initUI()
文件“C:\Users\..\workspace\Tkinter\u tutorial\absolutePositioning.py”,第22行,在initUI中
pic1_img=ImageTk.PhotoImage(pic1)
文件“C:\Users\..\Anaconda\lib\site packages\PIL\ImageTk.py”,第116行,在uu init中__
自粘贴(图像)
文件“C:\Users\..\Anaconda\lib\site packages\PIL\ImageTk.py”,第181行,粘贴
进口
导入错误:没有名为_imagingtk的模块
我尝试了
conda安装枕头
,该软件包被标记为已安装。然而,我继续得到这个错误。我正在运行Windows 64位python 2.7。是否有其他人遇到此问题,我如何解决?谢谢我最终找到了这个问题的解决方案,包括删除默认的枕头安装并获取旧版本的库
- 首先打开命令提示符(路径中有蟒蛇)并执行以下操作
或conda-remove-PIL
conda-remove-PIL
- 然后从以下位置安装PIL,
。确保将其安装到Lib/site软件包中PIL-1.1.7.win32-py2.7.exe
这对我和其他使用我安装了anaconda的项目的人都有效您是否安装了古老的PIL和它的现代叉形枕,而前者干扰了后者?您解决了吗?@micmica看到我的答案了吗