如何在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 ~]$

原文由 Donbeo 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.4k
1 个回答

tkinter 在 coreos 中作为 tkinter 包提供。你可以安装它

sudo yum install tkinter

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

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

对于 Python 3,你可以安装它

sudo yum install python3-tkinter

正如一些用户提到的,它可以用作 python36u-tkinterpython34-tkinter 取决于操作系统。

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

原文由 Chillar Anand 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题