Skip to content Skip to sidebar Skip to footer

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 lpuggi

Solution 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

Solution 2:

In Centos 7 you can use:

yum install python36-tkinter

Solution 3:

I solved the same problem using these two commands 100%

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

Solution 4:

Try the following command.

sudo yum install python3-tkinter

Now Test in your terminal:

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

Solution 5:

I believe tk come with python by default. If so, have you look to reinstall your python 3.4. (I prefer ver3.5). Procedures are mentioned in this website.

Steps:

  1. Download python version

    wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz

  2. Install decoding tool if you don't have: sudo yum install xz-libs

  3. Decode the xz encodeing xz -d Python-3.5.3.tar.xz
  4. Uncompress the decoded file tar -xvf Python-3.5.3.tar
  5. Move the desired directory to install python cd Python-3.5.3
  6. Configure python file ./configure
  7. Build using make
  8. Install using make altinstall
  9. Check if tkinter works. A tk window should pop out. Open a terminal and type the following:

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

The website also has other instructions for installing setuptools and pip which are very useful.

Post a Comment for "How To Install Python3-tk In Centos?"