0%

python ImageTk加载错误

python中使用PIL ImageTK出现以下问题:

Traceback (most recent call last):
    File "./ExportXiamiList.py", line 4, in <module>
        from tkinter import *
ImportError: No module named tkinter

Ubuntu下环境:

ExportXiamiList-master > python
python            python2.7         python2-config    python3.3         python3.4         python3m                          
python2           python2.7-config  python3           python3.3m        python3.4m        python-config            

安装如下包,不起作用:

sudo apt-get install python-pil python-pil.imagetk --reinstall

继续安装如下包解决问题:

sudo apt-get install python3-pil python3-pil.imagetk

python中ImageTK用法如下:

from PIL import Image
from PIL import ImageTk