Trying to run python code with TKinter-based widgets from a virtualenv.
user@computer:~/myproject$ env/bin/python Python
2.7.3 (default, Sep 26 2012,
I am using python2.7 with a virtualenv on a machine running linux mint. I received the exact same error as mentioned by the OP when running an application that required matplotlib in my virtualenv. "ImportError: No module named _tkinter, please install the python-tk package"
I ended up deleting and recreating my virtual environment using the suggestions in the above posts. Here are my steps:
pip freeze > requirements.txtdeactivatesudo apt-get install python-tkvirtualenv --system-site-packages source /bin/activate pip install -r now, when I run the same code as before, it has no problem importing _tkinter. Hope this helps! Thanks to the everyone's suggestions above. It really helped me a lot.