[Tutor] Need help with a virtual environment mess

Jim jf_byrnes at comcast.net
Sun May 6 12:05:30 EDT 2018

In a prior thread you guys helped me fix a problem with pip after I 
upgraded an installed version of python 3.6 on my Mint 18 system. Pip 
would not run in my python 3.6 virtual environment. The fix was to use 
synaptic to install python3-distutils. I thought everything was ok until 
I tried to run a old script from a different VE using python 3.5 which 
could not import tkinter.

I have 4 versions of python on this system:
system Python2 = 2.7.12 (default)
system Python3 = 3.5.2 (default)
a VE called env = 3.5.2
a Ve called env36 = 3.6.5

This is the error I get trying to import tkinter in env, I also get the 
same error if I try to import it in system python3.

jfb at jims-mint18 ~ $ source /home/jfb/EVs/env/bin/activate
(env) jfb at jims-mint18 ~ $ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> import tkinter as tk
Traceback (most recent call last):
   File "/usr/lib/python3.5/tkinter/__init__.py", line 36, in <module>
     import _tkinter
ImportError: No module named '_tkinter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/python3.5/tkinter/__init__.py", line 38, in <module>
     raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk 

If I go to synaptic and install the python3-tk it installs version 3.6.5 
of the package and I can still not import tkinter in env with python 
3.5.2, but I can in env36 with python 3.6.5.

I don't know if it makes a difference but I installed python3.6 from

Thanks,  Jim

More information about the Tutor mailing list