python ubuntu - How to pip or easy_install tkinter
2.7 python3 (9)
I had the similar problem with Win-8 and python-3.4 32 bit , I got it resolved by downloading same version from python.org .
Next step will be to hit the repair button and Install the Tk/tkinter Package or Just hit the repair. Now should get Python34/Lib/tkinter Module present. The import tkinter should work ..
My Idle is throwing errors that and says
tkinter can't be imported.
Is there a simple way to install
There seem to be a lot of package names flying around for this...
This and other assorted variations with
tkinter-pypy aren't working.
pip install python-tk
I'm on Windows with Python 2.7 and can't
When you install python for Windows, use the standard option or install everything it asks. I got the error because I deselected tcl.
Well i can see two solutions here:
Tkinter (and, since Python 3.1, ttk) are included with all standard Python distributions. It is important that you use a version of Python supporting Tk 8.5 or greater, and ttk. We recommend installing the "ActivePython" distribution from ActiveState, which includes everything you'll need.
In your web browser, go to Activestate.com, and follow along the links to download the Community Edition of ActivePython for Windows. Make sure you're downloading a 3.1 or newer version, not a 2.x version.
Run the installer, and follow along. You'll end up with a fresh install of ActivePython, located in, e.g.
C:\python32. From a Windows command prompt, or the Start Menu's "Run..." command, you should then be able to run a Python shell via:
This should give you the Python command prompt. From the prompt, enter these two commands:
>>> import tkinter >>> tkinter._test()
This should pop up a small window; the first line at the top of the window should say "This is Tcl/Tk version 8.5"; make sure it is not 8.4!
2) Uninstall 64-bit Python and install 32 bit Python.
if your using python 3.4.1 just write this line
from tkinter import * this will put everything in the module into the default namespace of your program. in fact instead of referring to say a button like
tkinter.Button you just type
I solved the same problem using these two commands 100%
sudo yum -y update sudo yum -y install python36u-tkinter
The Tkinter library is built in with every Python installation. And since you are on windows, I believe you installed python through the binaries on their website?
if so, Then most probably you are typing the command wrong. It should be:
import Tkinter as tk
Note the capital T at the beginning of Tkinter.
For Python 3,
import tkinter as tk
To use pip, it is not mandatory that you need to install pip in the system directly. You can use it through
virtualenv. What you can do is follow these steps:
- Download virtualenv tar.gz file from https://pypi.python.org/pypi/virtualenv
- Unzip it with 7zip or some other tool
We normally need to install Python packages for one particular project. So, now create a project folder, let’s say myproject.
- Copy the virtualenv.py file from the decompressed folder of
virtualenv, and paste inside the myproject folder
Now create a virtual environment, let’s say myvirtualenv as follows, inside the myproject folder:
python virtualenv.py myvirtualenv
It will show you:
New python executable in myvirtualenv\Scripts\python.exe Installing setuptools....................................done. Installing pip.........................done.
Now your virtual environment, myvirtualenv, is created inside your project folder. You might notice, pip is now installed inside you virtual environment. All you need to do is activate the virtual environment with the following command.
You will see the following at the command prompt:
(myvirtualenv) PATH\TO\YOUR\PROJECT\FOLDER>pip install package_name
Now you can start using pip, but make sure you have activated the virtualenv looking at the left of your prompt.
This is one of the easiest way to install pip i.e. inside virtual environment, but you need to have virtualenv.py file with you.
For more ways to install pip/virtualenv/virtualenvwrapper, you can refer to thegauraw.tumblr.com.