我有一个非常令人困惑的问题:
我使用tkinter构建了一个python程序。然后,我将ubuntu 13.10(amd64)远程升级到ubuntu 14.04 LTS,现在我尝试运行tkinter程序。我的编译器告诉我
ImportError: No module named tkinter
(与Tkinter或tk / Tk相同)然后,我尝试使用pip重新安装tkinter:
$ pip install tkinter
Could not find any downloads that satisfy the requirement tkinter
Cleaning up...
No distributions at all found for tkinter
再次与Tkinter,tkinter,tk和Tk相同
所以发生了什么事?我必须运行类似的东西吗
$ pip update
(因为tk不再位于pip存储库中),但是为什么我的PC上不再安装了tk?
编辑:1.我没有root访问权2.在pip.log中是
>
Downloading/unpacking tk Getting page
> https://pypi.python.org/simple/tk/ Could not fetch URL
> https://pypi.python.org/simple/tk/: 404 Client Error: Not Found Will
> skip URL https://pypi.python.org/simple/tk/ when looking for download
> links for tk Getting page https://pypi.python.org/simple/ URLs to
> search for versions for tk: * https://pypi.python.org/simple/tk/
> Getting page https://pypi.python.org/simple/tk/ Could not fetch URL
> https://pypi.python.org/simple/tk/: 404 Client Error: Not Found Will
> skip URL https://pypi.python.org/simple/tk/ when looking for download
> links for tk Could not find any downloads that satisfy the
> requirement tk
当我尝试不运行而在RaspberryPi上使用apt安装某些东西时,发生了一些非常接近的事情
$ apt-get update
几个月
我很乐意为您提供帮助。
python-tk
无法使用pip安装。
由于tk是TkInter(-> TK的接口,用C(++)编写),因此您需要安装C(++)库TK。
您不能使用来安装此库pip
,因为该库pip
旨在安装(主要)[1]个纯python软件包。顺便说一句,您没有足够的权利来安装该库。因此,您需要向您的超级用户寻求帮助。
唯一的安装方法是使用
sudo apt-get install python-tk # python2
或者
sudo apt-get install python3-tk #python3
最后但并非最不重要的一点是,您将不得不使用pip3
安装软件包python3
。
与无法freetype
使用进行安装相同pip
。
注意:最好使用python3 -m pip
而不是pip3
,因为python3
您的计算机上可能有多个安装(例如python3.4
和python3.5.1
)
[1]:实际上pip能够编译C / C ++库,但是似乎无法安装System-Libraries。或者将来会创建此程序包。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句