Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install python3-tk in centos?

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 ~]$ 
like image 918
Donbeo Avatar asked Nov 14 '16 12:11

Donbeo


People also ask

Does Tkinter come with python3?

Tkinter is the de facto way in Python to create Graphical User Interfaces (GUIs). Installing Tkinter on Windows is as simple as installing Python 3. x since Tkinter is included in the Python 3 core.

Can you pip install Tkinter?

Tkinter can be installed using pip.

Is Tkinter already installed in Python?

Tkinter is widely available for all operating systems. It is pre-install in the Python. To work with the Tkinter, we must install the Python.


1 Answers

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
like image 150
Pandikunta Anand Reddy Avatar answered Oct 13 '22 14:10

Pandikunta Anand Reddy