Python 2.7 PIL.ImageTk导入和/或安装错误
当我到达我心爱的Spyder控制台时,它会用Python 2.7 PIL.ImageTk导入和/或安装错误,python-2.7,ipython,python-imaging-library,python-import,importerror,Python 2.7,Ipython,Python Imaging Library,Python Import,Importerror,当我到达我心爱的Spyder控制台时,它会用 Python 2.7.12 (default, Dec 4 2017, 14:50:18) Type "copyright", "credits" or "license" for more information. IPython 2.4.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
我继续键入以下内容:
In [1]: from PIL import Image
In [2]: from PIL import ImageTk
它显示了另一条线,好像一切都是对的。
然后,在下一行,我键入以下内容:
In [1]: from PIL import Image
In [2]: from PIL import ImageTk
它返回这个:
Traceback (most recent call last):
File "<ipython-input-2-47edf18ebb7f>", line 1, in <module>
from PIL import ImageTk
ImportError: cannot import name ImageTk
In [3]: Image.VERSION
Out[3]: '1.1.7'
我在这里不知所措。请发送帮助。正在执行
sudo apt-get install python-imaging=1.1.7-4
然后
sudo apt-get install python-imaging-tk
解决了这个问题
这仍然困扰着我,但至少我的依赖关系现在起作用了
sudo apt-get install python-imaging-tk
这正好解决了我的问题。这是针对Python2.7的