I want to run python code on Ubuntu 14.04, but when I execute it, it gives me the following error message
Traceback (most recent call last): File "main.py", line 2, in <module> from tkinter import * ImportError: No module named tkinter
Instructions for Ubuntu Install Tkinter: apt-get install python-tk (restart after) Install setuptools: sudo apt-get install python-setuptools. Install suds: sudo easy_install suds. Install matplotlib: sudo apt-get install python-matplotlib.
Tkinter can be installed in other Linux based distributions from the package manager. You can also install Tkinter packages in Linux by following installation instructions available here.
You may have to install Tcl and Tk (when using RPM, install the -devel RPMs as well) and/or edit the setup.py script to point to the right locations where Tcl/Tk is installed. If you install Tcl/Tk in the default locations, simply rerunning "make" should build the _tkinter extension.
Tkinter can be installed using pip. The following command is run in the command prompt to install Tkinter. This command will start downloading and installing packages related to the Tkinter library.
Try writing the following in the terminal:
sudo apt-get install python-tk
Don't forget to actually import Tkinter module at the beginning of your program:
import Tkinter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With