python-imaging-tk : Depends: python-imaging (= 1.1.7-4ubuntu0.12.04.3) but 3.1.2-0ubuntu1.1 is to be installed E: Unable to corre

时间:2022-11-25 00:23:47

 

最近,将电脑主机升级到ubuntu16.04,但是需要用到 python-imaging-tk,先是报错:

import PIL.ImageTk as ImageTk
ImportError: No module named ImageTk

参考网上的是pythonimaging-tk的包没有安装,所以

sudo apt-get install python-imaging-tk

但是报错
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-imaging-tk : Depends: python-imaging (= 1.1.7-4ubuntu0.12.04.3) but 3.1.2-0ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.

我自己也是小白,以前没遇到这个错,只能谷歌啦,但是没谷歌出什么东西,那我就改变检索方式:

python-imaging  3.1.2-0ubuntu1.1

找到一个网页https://launchpad.net/ubuntu/xenial/amd64/python-imaging/3.1.2-0ubuntu1.1,上面说:

PIL used to provide a PIL.pth file which allowed you to `import Image` but
 this is deprecated. Use `from PIL import Image` now, or install this
 compatibility package to temporarily get the old behavior back.
 .
 This compatibility package is built for Python 2 only.

网页还提供deb之类的下载,那我就尝试下载,发现不行,后面又想,我只缺tk模块呀,我单独下载安装就行啦,然后就

谷歌:

python-imaging-tk   3.1.2-0ubuntu1.1

找到这个网页https://ubuntu.pkgs.org/16.04/ubuntu-updates-main-amd64/python-pil.imagetk_3.1.2-0ubuntu1.1_amd64.deb.html

下载了:python-pil.imagetk_3.1.2-0ubuntu1.1_amd64.deb,系统要一致哦,

在终端:$ sudo dpkg -i python-pil.imagetk_3.1.2-0ubuntu1.1_amd64.deb Selecting previously unselected package python-pil.imagetk:amd64.
(Reading database ... 224219 files and directories currently installed.)
Preparing to unpack python-pil.imagetk_3.1.2-0ubuntu1.1_amd64.deb ...
Unpacking python-pil.imagetk:amd64 (3.1.2-0ubuntu1.1) ...
Setting up python-pil.imagetk:amd64 (3.1.2-0ubuntu1.1) ...

 

大功告成,其实我们有些在sudo apt-get install 找不到相应的版本可以自己安装哈!!!!!感觉自己又获得一个新技能,也从这里看出自己很low!!!!哈哈,没事没事,

每天进步一点点撒!!!