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, 21:51:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
raise ImportError, str(msg) + ', please install the python-tk package' ImportError: No module named _tkinter, please install the python-tk package
What is the proper way to install TK to the virtualenv?
TKinter
, but I've run into similar issues trying to getwxPython
andpyGTK
working inside avirtualenv
. I was never able to find a satisfactory method for installing these into avirtualenv
because they are heavily dependent on shared libraries. Do you need some specific version ofTkinter
other than the one in your system site packages? Otherwise I would recommend just creating avirtualenv
with the--system-site-packages
flag, then locally installing whatever other specific modules you need.