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 does not work.

How can i fix this?

EDIT: Installation 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 ~]$ 
+10
source share
10 answers

tkinter is available in coreos like tkinter. You can install it with

sudo yum install tkinter

Once this 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 mentioned by some users, it is available as python36u-tkinteror python34-tkinterdepending on the OS.

sudo yum install python34-tkinter
sudo yum install python36u-tkinter
+12
source

In Centos 7, you can use:

yum install python36-tkinter
+5
source

, : 100%

sudo yum -y update
sudo yum -y install python36u-tkinter
+3

.

sudo yum install python3-tkinter

:

>>> import tkinter
>>> tkinter._test()
+2

, tk python . , python 3.4. ( ver3.5). .

:

python3.5 import tkinter as tk root = tk.Tk()

- setuptools pip, .

+2

, :

  • yum -y install tkinter tcl-devel tk-devel

  • python: vim ......./Python3.5.1/Modules/Setup.dist

:

_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \

-L/usr/local/lib \

-I/usr/local/include \

-ltk8.5 -ltcl8.5 \ # default is 8.2 and you should change it to the version you installed in step1

-lX11

3.

./configure
make && make install

:

[root@localhost Python-3.5.1]# python3
Python 3.5.1 (default, Jun 19 2017, 22:43:42) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> 
+2

python. python 3.4 sudo yum install python34-tkinter

+2

, , (SCL), tkinter.

tkinter: yum search tkinter
tkinter, yum install rh-python36-python-tkinter

, python, " " tkinter.

+1

, . , .

sudo yum update
sudo yum install rh-python36-python-tkinter

if you are using a different version of python3 try searching your package as i did with

sudo yum search tkinter

and see which option suits your version

0
source

yum search tkint yum installation ...

0
source

Source: https://habr.com/ru/post/1660683/


All Articles