title: Python/Tkinter : ModuleNotFoundError: No module named '_tkinter'
body: <p>This is my first post StackOverflow, I will try to make it as correct and complete as possible if you have any tips to improve my post I will gladly accept it.</p>
  
  <p>I'm having trouble running code written in Python that uses Tkinter. </p>
  
  <p>I will try to describe in detail my actions to facilitate the identification of the error.</p>
  
  <p>I started a course at Coursera on DSP (Digital Signal Processing) where it is suggested to install a tool written in python (and a little bit of C). I'm using Arch Linux.</p>
  
  <p>link on Github:
  <a href="http://sms-tools%20repo" rel="nofollow noreferrer">sms-tools repo</a></p>
  
  <p>Using <em>pyenv/virtualenv/virtualenvwrapper</em> I created an environment with Python 3.7.5, as recommended in the "How to use" section of the repository.</p>
  
  <p>I installed the required libraries in my environment by pip:</p>
  
  <p><code>%pip install ipython numpy matplotlib scipy cython</code></p>
  
  <p>I compiled some C functions in the <em>"/sms-tools/software/models/utilFunctions_C"</em></p>
  
  <p>directory with the following command: </p>
  
  <p><code>%python compileModule.py build_ext --inplace</code></p>
  
  <p>Finally, I run the models GUI in the directory <em>"/sms-tools/software/models_interface"</em></p>
  
  <p><code>%python models_GUI.py</code></p>
  
  <p>and I get the following message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "models_GUI.py", line 6, in &lt;module&gt;
      from Tkinter import *   ## notice capitalized T in Tkinter 
  ModuleNotFoundError: No module named 'Tkinter'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "models_GUI.py", line 9, in &lt;module&gt;
      from tkinter import *   ## notice lowercase 't' in tkinter here
    File "~/.pyenv/versions/3.7.5/lib/python3.7/tkinter/__init__.py", line 36, in &lt;module&gt;
      import _tkinter # If this fails your Python may not be configured for Tk
  ModuleNotFoundError: No module named '_tkinter'
  </code></pre>
  
  <p>I will now describe some of my attempts to solve the problem:</p>
  
  <p>Looking at <a href="https://wiki.python.org/moin/TkInter" rel="nofollow noreferrer">Tkinter section in Python Wiki</a> I tried installing Tcl and Tk.</p>
  
  <p><code>%sudo pacman -S tk</code></p>
  
  <p>but it was already installed. after that I tried installing with pip:</p>
  
  <p><code>%pip install tk</code></p>
  
  <p>and</p>
  
  <p><code>%pip install tkinter</code></p>
  
  <p>and the error remains the same.</p>
  
  <p>I also tried to create a symlink with this code:
  <code>%ln -s /usr/lib/python3.8/lib-dynload/_tkinter.cpython-38-x86_64-linux-gnu.so _tkinter.cpython-38-x86_64-linux-gnu.so</code></p>
  
  <p>the symlink was created in the following folders:</p>
  
  <p><code>~/.ve/Coursera_DSP/lib/python3.7/lib-dynload</code></p>
  
  <p>and</p>
  
  <p><code>.pyenv/versions/3.7.5/lib/python3.7/lib-dynload</code></p>
  
  <p>But I still get the same error.</p>
  
  <p>I appreciate it if anyone has any suggestions and I apologize for the language errors since English is not my mother tongue.</p>
  
  <p>After an incessant search on the internet, I believe the problem is related to pyenv and TCL/TK.
  I don't understand much about the subject but I suspect that in the creation of the environment by virtualenv python has lost the connection with TCL/TK. Does that make any sense?</p>