如何在centos中安装python3-tk?

前端之家收集整理的这篇文章主要介绍了如何在centos中安装python3-tk?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要安装 python3-tk才能使用matplotlib.
I have tried: 

(python_3.4_numerical) [lpuggini@machinelearn-1 ~]$sudo yum install python3-tk
[sudo] password for lpuggini: 
Loaded plugins: fastestmirror,langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.clouvider.net
 * epel: epel.check-update.co.uk
 * extras: mirror.sov.uk.goscomb.net
 * updates: mirrors.clouvider.net
No package python3-tk available.
Error: Nothing to do
(python_3.4_numerical) [lpuggini@machinelearn-1 ~]$

但它不起作用.

我该如何解决

编辑:
从pip安装不起作用:

(python_3.4_numerical) [lpuggini@machinelearn-1 ~]$pip install pygtk
Collecting pygtk
  Using cached pygtk-2.24.0.tar.bz2
    Complete output from command python setup.py egg_info:
    ********************************************************************
    * Building PyGTK using distutils is only supported on windows. *
    * To build PyGTK in a supported way,read the INSTALL file.    *
    ********************************************************************

    ----------------------------------------
Command "python setup.py egg_info" Failed with error code 1 in /tmp/pip-build-nzjsuhx3/pygtk/
(python_3.4_numerical) [lpuggini@machinelearn-1 ~]$
tkinter在coreos中作为tkinter包提供.你可以安装它
sudo yum install tkinter

完成后,您可以像往常一样导入和使用它.

>>> import tkinter
>>> tkinter._test()

对于Python 3,您可以使用它进行安装

sudo yum install python3-tkinter

正如一些用户所提到的,它可以作为python36u-tkinter或python34-tkinter提供,具体取决于操作系统.

sudo yum install python34-tkinter
sudo yum install python36u-tkinter

猜你在找的CentOS相关文章