如何在centos中安装python3-tk? [英] how to install python3-tk in centos?

查看:299
本文介绍了如何在centos中安装python3-tk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要安装python3-tk才能使用matplotlib。

 我尝试过:

(python_3.4_numerical)[lpuggini @ machinelearn-1〜] $ sudo yum install python3-tk
lpuggini的[sudo]密码:
加载的插件:fastmirror,langpacks
从缓存的主机文件
中加载镜像速度*基础:mirrors.clouvider.net
* epel:epel.check-update.co.uk
*其他:mirror.sov.uk.goscomb.net
*更新:mirrors.clouvider.net
没有软件包python3 -tk可用。
错误:无事可做
(python_3.4_numerical)[lpuggini @ machinelearn-1〜] $

,但是它不起作用。



我该如何解决?



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

 (python_3.4_numerical)[lpuggini @ machinelearn-1〜] $ pip install pygtk 
收集pygtk
使用缓存的pygtk-2.24.0.tar.bz2
命令python setup.py egg_info的完整输出:
********************* ***************************************************
*仅在Windows上支持使用distutils构建PyGTK。 *
*要以受支持的方式构建PyGTK,请阅读INSTALL文件。 *
********************************************* ***********************

------------------- ---------------------
命令 python setup.py egg_info在/ tmp / pip-build-nzjsuhx3 / pygtk /中失败,错误代码为1
(python_3.4_numerical)[lpuggini @ machinelearn-1〜] $


解决方案

tkinter在Coreos中以 tkinter 软件包的形式提供。您可以使用

  sudo yum install tkinter 


完成后,即可照常导入和使用。

  >>>导入tkinter 
>> tkinter._test()

对于Python 3,您可以使用

$ b $进行安装b

  sudo yum install python3-tkinter 

某些用户提到,根据操作系统,它可以作为 python36u-tkinter python34-tkinter 来提供。

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


I need to install python3-tk in order to use 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 ~]$ 

but it is not working.

How can I fix it?

EDIT: Installing from pip does not work:

(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 is available in coreos as tkinter package. You can install it with

sudo yum install tkinter

Once it is done, you can import and use it as usual.

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

For Python 3, you can install it with

sudo yum install python3-tkinter

As some users mentioned, it is available as python36u-tkinter or python34-tkinter depending on OS.

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

这篇关于如何在centos中安装python3-tk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆