I'm decently new to using a Raspberry Pi and I'm trying to set up a simple GUI application to launch from my Pi. I'm using a Raspberry Pi3, with Python 3.4.3 installed.
When I type python
:
~$ python
Python 3.4.3 |Continuum Analytics, Inc.| (default, Aug 21 2015, 00:53:08)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
When I try to import tkinter:
>>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/miniconda3/lib/python3.4/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'
>>>
So, I can see that the error is coming from miniconda3. The only reason I had it installed was to use PyQt5, but I was getting a similar error when I tried to use that, so I switched over to Tkinter because there were more examples of using it with a pi online.
I have run the following commands to try to install Tkinter:
sudo apt-get install tk-dev
sudo apt-get install tk8.6-dev
sudo apt-get install python-imaging-tk
sudo apt-get install python-tk
sudo apt-get install python3-tk
How can I fix this? I have read in some places to make
python again, but no one says how to do that.
Thanks guys!
which python
and try if tk works when lauching python using/usr/bin/python
– user.dz Mar 25 '17 at 18:17