I just upgraded to python 3.9 (Earlier I had python 3.8.2)
I was working on a project where I had to use tkinter module.
Everything worked fine in Python3.8.2
But after upgrading to Python3.9 , I get this error :
The error is :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/tkinter/__init__.py", line 37, in
<module>
import _tkinter # If this fails your Python may not be configured for
Tk
ModuleNotFoundError: No module named '_tkinter'
So anyone knows how to fix this ?
P.S :
I have tried using
sudo apt install python3-tk
It only gives this message :
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-tk is already the newest version (3.8.2-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Edit :
I found 2 pip
installed on my system namely : pip3
and pip3.9
(I don't know how)
One is familiar pre existing pip3
When I do pip3 list
Package Version
------------------------ --------------------
aiohttp 3.6.2
apturl 0.5.2
astroid 2.4.2
async-timeout 3.0.1
attrs 20.2.0
autopep8 1.5.4
#(And many more...)
But when I do pip3.9 list
, I get only 2 modules installed:
Package Version
---------- -------
pip 20.2.3
setuptools 41.2.0