ImportError: No module named '_tkinter', please install the python3-tk package
After an sudo apt-get upgrade
, I get the following error:
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
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 package
I have python3-tk
installed. I already tried purging and installing it. Doesn't change anything. (Interestingly, the /usr/lib/python3.5/tkinter
still existed after pruging... and manually removing it did only lead to another error)
How can I fix this problem?
Did not solve the problem:
$ sudo apt-get install tk8.6-dev
$ sudo apt-get install python3-tkinter # does not exist
$ sudo apt-get install python3-tk # exists and is installed
Comment answers
$ ls -l /usr/lib/python3.5/tkinter
total 372
-rw-r--r-- 1 root root 1791 Nov 28 17:50 colorchooser.py
-rw-r--r-- 1 root root 1412 Nov 28 17:50 commondialog.py
-rw-r--r-- 1 root root 1493 Nov 28 17:50 constants.py
-rw-r--r-- 1 root root 1568 Nov 28 17:50 dialog.py
-rw-r--r-- 1 root root 11488 Nov 28 17:50 dnd.py
-rw-r--r-- 1 root root 14502 Nov 28 17:50 filedialog.py
-rw-r--r-- 1 root root 6581 Nov 28 17:50 font.py
-rw-r--r-- 1 root root 162249 Nov 28 17:50 __init__.py
-rw-r--r-- 1 root root 148 Nov 28 17:50 __main__.py
-rw-r--r-- 1 root root 3701 Nov 28 17:50 messagebox.py
drwxr-xr-x 2 root root 4096 Nov 30 08:12 __pycache__
-rw-r--r-- 1 root root 1814 Nov 28 17:50 scrolledtext.py
-rw-r--r-- 1 root root 11424 Nov 28 17:50 simpledialog.py
-rw-r--r-- 1 root root 77014 Nov 28 17:50 tix.py
-rw-r--r-- 1 root root 55839 Nov 28 17:50 ttk.py
When moving the directory, I get:
$ sudo mv tkinter tkinter-backup
$ python3
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
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tkinter'
More info
$ which python3
/usr/bin/python3
$ apt list python3
Listing... Done
python3/xenial,now 3.5.1-3 amd64 [installed]
16.04 python python3 tkinter
add a comment |
After an sudo apt-get upgrade
, I get the following error:
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
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 package
I have python3-tk
installed. I already tried purging and installing it. Doesn't change anything. (Interestingly, the /usr/lib/python3.5/tkinter
still existed after pruging... and manually removing it did only lead to another error)
How can I fix this problem?
Did not solve the problem:
$ sudo apt-get install tk8.6-dev
$ sudo apt-get install python3-tkinter # does not exist
$ sudo apt-get install python3-tk # exists and is installed
Comment answers
$ ls -l /usr/lib/python3.5/tkinter
total 372
-rw-r--r-- 1 root root 1791 Nov 28 17:50 colorchooser.py
-rw-r--r-- 1 root root 1412 Nov 28 17:50 commondialog.py
-rw-r--r-- 1 root root 1493 Nov 28 17:50 constants.py
-rw-r--r-- 1 root root 1568 Nov 28 17:50 dialog.py
-rw-r--r-- 1 root root 11488 Nov 28 17:50 dnd.py
-rw-r--r-- 1 root root 14502 Nov 28 17:50 filedialog.py
-rw-r--r-- 1 root root 6581 Nov 28 17:50 font.py
-rw-r--r-- 1 root root 162249 Nov 28 17:50 __init__.py
-rw-r--r-- 1 root root 148 Nov 28 17:50 __main__.py
-rw-r--r-- 1 root root 3701 Nov 28 17:50 messagebox.py
drwxr-xr-x 2 root root 4096 Nov 30 08:12 __pycache__
-rw-r--r-- 1 root root 1814 Nov 28 17:50 scrolledtext.py
-rw-r--r-- 1 root root 11424 Nov 28 17:50 simpledialog.py
-rw-r--r-- 1 root root 77014 Nov 28 17:50 tix.py
-rw-r--r-- 1 root root 55839 Nov 28 17:50 ttk.py
When moving the directory, I get:
$ sudo mv tkinter tkinter-backup
$ python3
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
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tkinter'
More info
$ which python3
/usr/bin/python3
$ apt list python3
Listing... Done
python3/xenial,now 3.5.1-3 amd64 [installed]
16.04 python python3 tkinter
What do you see if you runls -l /usr/lib/python3.5/tkinter
? You say that you manually removed it resulting in another error, what was that error?
– Steve
May 8 '18 at 12:52
Where is your python installation from? Can you runwhich python3
andapt list python3
?
– Steve
May 8 '18 at 14:05
1
@Steve See edited question for the answers
– Martin Thoma
May 8 '18 at 14:43
2
Possible duplicate of ImportError: No named '_tkinter', please install the python3-tk package
– WinEunuuchs2Unix
Jan 1 at 14:32
add a comment |
After an sudo apt-get upgrade
, I get the following error:
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
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 package
I have python3-tk
installed. I already tried purging and installing it. Doesn't change anything. (Interestingly, the /usr/lib/python3.5/tkinter
still existed after pruging... and manually removing it did only lead to another error)
How can I fix this problem?
Did not solve the problem:
$ sudo apt-get install tk8.6-dev
$ sudo apt-get install python3-tkinter # does not exist
$ sudo apt-get install python3-tk # exists and is installed
Comment answers
$ ls -l /usr/lib/python3.5/tkinter
total 372
-rw-r--r-- 1 root root 1791 Nov 28 17:50 colorchooser.py
-rw-r--r-- 1 root root 1412 Nov 28 17:50 commondialog.py
-rw-r--r-- 1 root root 1493 Nov 28 17:50 constants.py
-rw-r--r-- 1 root root 1568 Nov 28 17:50 dialog.py
-rw-r--r-- 1 root root 11488 Nov 28 17:50 dnd.py
-rw-r--r-- 1 root root 14502 Nov 28 17:50 filedialog.py
-rw-r--r-- 1 root root 6581 Nov 28 17:50 font.py
-rw-r--r-- 1 root root 162249 Nov 28 17:50 __init__.py
-rw-r--r-- 1 root root 148 Nov 28 17:50 __main__.py
-rw-r--r-- 1 root root 3701 Nov 28 17:50 messagebox.py
drwxr-xr-x 2 root root 4096 Nov 30 08:12 __pycache__
-rw-r--r-- 1 root root 1814 Nov 28 17:50 scrolledtext.py
-rw-r--r-- 1 root root 11424 Nov 28 17:50 simpledialog.py
-rw-r--r-- 1 root root 77014 Nov 28 17:50 tix.py
-rw-r--r-- 1 root root 55839 Nov 28 17:50 ttk.py
When moving the directory, I get:
$ sudo mv tkinter tkinter-backup
$ python3
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
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tkinter'
More info
$ which python3
/usr/bin/python3
$ apt list python3
Listing... Done
python3/xenial,now 3.5.1-3 amd64 [installed]
16.04 python python3 tkinter
After an sudo apt-get upgrade
, I get the following error:
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
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 package
I have python3-tk
installed. I already tried purging and installing it. Doesn't change anything. (Interestingly, the /usr/lib/python3.5/tkinter
still existed after pruging... and manually removing it did only lead to another error)
How can I fix this problem?
Did not solve the problem:
$ sudo apt-get install tk8.6-dev
$ sudo apt-get install python3-tkinter # does not exist
$ sudo apt-get install python3-tk # exists and is installed
Comment answers
$ ls -l /usr/lib/python3.5/tkinter
total 372
-rw-r--r-- 1 root root 1791 Nov 28 17:50 colorchooser.py
-rw-r--r-- 1 root root 1412 Nov 28 17:50 commondialog.py
-rw-r--r-- 1 root root 1493 Nov 28 17:50 constants.py
-rw-r--r-- 1 root root 1568 Nov 28 17:50 dialog.py
-rw-r--r-- 1 root root 11488 Nov 28 17:50 dnd.py
-rw-r--r-- 1 root root 14502 Nov 28 17:50 filedialog.py
-rw-r--r-- 1 root root 6581 Nov 28 17:50 font.py
-rw-r--r-- 1 root root 162249 Nov 28 17:50 __init__.py
-rw-r--r-- 1 root root 148 Nov 28 17:50 __main__.py
-rw-r--r-- 1 root root 3701 Nov 28 17:50 messagebox.py
drwxr-xr-x 2 root root 4096 Nov 30 08:12 __pycache__
-rw-r--r-- 1 root root 1814 Nov 28 17:50 scrolledtext.py
-rw-r--r-- 1 root root 11424 Nov 28 17:50 simpledialog.py
-rw-r--r-- 1 root root 77014 Nov 28 17:50 tix.py
-rw-r--r-- 1 root root 55839 Nov 28 17:50 ttk.py
When moving the directory, I get:
$ sudo mv tkinter tkinter-backup
$ python3
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
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tkinter'
More info
$ which python3
/usr/bin/python3
$ apt list python3
Listing... Done
python3/xenial,now 3.5.1-3 amd64 [installed]
16.04 python python3 tkinter
16.04 python python3 tkinter
edited May 8 '18 at 14:43
Martin Thoma
asked May 8 '18 at 8:16
Martin ThomaMartin Thoma
6,468155172
6,468155172
What do you see if you runls -l /usr/lib/python3.5/tkinter
? You say that you manually removed it resulting in another error, what was that error?
– Steve
May 8 '18 at 12:52
Where is your python installation from? Can you runwhich python3
andapt list python3
?
– Steve
May 8 '18 at 14:05
1
@Steve See edited question for the answers
– Martin Thoma
May 8 '18 at 14:43
2
Possible duplicate of ImportError: No named '_tkinter', please install the python3-tk package
– WinEunuuchs2Unix
Jan 1 at 14:32
add a comment |
What do you see if you runls -l /usr/lib/python3.5/tkinter
? You say that you manually removed it resulting in another error, what was that error?
– Steve
May 8 '18 at 12:52
Where is your python installation from? Can you runwhich python3
andapt list python3
?
– Steve
May 8 '18 at 14:05
1
@Steve See edited question for the answers
– Martin Thoma
May 8 '18 at 14:43
2
Possible duplicate of ImportError: No named '_tkinter', please install the python3-tk package
– WinEunuuchs2Unix
Jan 1 at 14:32
What do you see if you run
ls -l /usr/lib/python3.5/tkinter
? You say that you manually removed it resulting in another error, what was that error?– Steve
May 8 '18 at 12:52
What do you see if you run
ls -l /usr/lib/python3.5/tkinter
? You say that you manually removed it resulting in another error, what was that error?– Steve
May 8 '18 at 12:52
Where is your python installation from? Can you run
which python3
and apt list python3
?– Steve
May 8 '18 at 14:05
Where is your python installation from? Can you run
which python3
and apt list python3
?– Steve
May 8 '18 at 14:05
1
1
@Steve See edited question for the answers
– Martin Thoma
May 8 '18 at 14:43
@Steve See edited question for the answers
– Martin Thoma
May 8 '18 at 14:43
2
2
Possible duplicate of ImportError: No named '_tkinter', please install the python3-tk package
– WinEunuuchs2Unix
Jan 1 at 14:32
Possible duplicate of ImportError: No named '_tkinter', please install the python3-tk package
– WinEunuuchs2Unix
Jan 1 at 14:32
add a comment |
3 Answers
3
active
oldest
votes
The python3-tk package has support for python versions 3.6 and 3.7, not 3.5, which is your default. Change your default python to a version supported if your work supports that. Otherwise, if you really need version3.5, you will need to track down the support files.
add a comment |
In my case, I was getting the same error as "ImportError: No module named '_tkinter'" for python3.5 in-spite of doing the following things:
- Installing python3-tk and tkinter-dev
- Tkinter directory being available in /usr/lib/python3.5.
The observed error was from the following file:
File "/usr/local/lib/python3.5/tkinter/init.py", line 35, in
import _tkinter # If this fails your Python may not be configured for Tk
However, when I simply ran the python from /usr/bin like /usr/bin/python3.5 from terminal, it worked for me!
In short, just ensure the python version being run from terminal has the tkinter installed and configured :)
I have Ubuntu16.04 installed on my system which comes with default python2.7 and python3.5
add a comment |
Have you tried import Tkinter
(with a capital T) in your python program? That did it for me.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1033473%2fimporterror-no-module-named-tkinter-please-install-the-python3-tk-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The python3-tk package has support for python versions 3.6 and 3.7, not 3.5, which is your default. Change your default python to a version supported if your work supports that. Otherwise, if you really need version3.5, you will need to track down the support files.
add a comment |
The python3-tk package has support for python versions 3.6 and 3.7, not 3.5, which is your default. Change your default python to a version supported if your work supports that. Otherwise, if you really need version3.5, you will need to track down the support files.
add a comment |
The python3-tk package has support for python versions 3.6 and 3.7, not 3.5, which is your default. Change your default python to a version supported if your work supports that. Otherwise, if you really need version3.5, you will need to track down the support files.
The python3-tk package has support for python versions 3.6 and 3.7, not 3.5, which is your default. Change your default python to a version supported if your work supports that. Otherwise, if you really need version3.5, you will need to track down the support files.
answered May 8 '18 at 15:43
ubfan1ubfan1
9,27641527
9,27641527
add a comment |
add a comment |
In my case, I was getting the same error as "ImportError: No module named '_tkinter'" for python3.5 in-spite of doing the following things:
- Installing python3-tk and tkinter-dev
- Tkinter directory being available in /usr/lib/python3.5.
The observed error was from the following file:
File "/usr/local/lib/python3.5/tkinter/init.py", line 35, in
import _tkinter # If this fails your Python may not be configured for Tk
However, when I simply ran the python from /usr/bin like /usr/bin/python3.5 from terminal, it worked for me!
In short, just ensure the python version being run from terminal has the tkinter installed and configured :)
I have Ubuntu16.04 installed on my system which comes with default python2.7 and python3.5
add a comment |
In my case, I was getting the same error as "ImportError: No module named '_tkinter'" for python3.5 in-spite of doing the following things:
- Installing python3-tk and tkinter-dev
- Tkinter directory being available in /usr/lib/python3.5.
The observed error was from the following file:
File "/usr/local/lib/python3.5/tkinter/init.py", line 35, in
import _tkinter # If this fails your Python may not be configured for Tk
However, when I simply ran the python from /usr/bin like /usr/bin/python3.5 from terminal, it worked for me!
In short, just ensure the python version being run from terminal has the tkinter installed and configured :)
I have Ubuntu16.04 installed on my system which comes with default python2.7 and python3.5
add a comment |
In my case, I was getting the same error as "ImportError: No module named '_tkinter'" for python3.5 in-spite of doing the following things:
- Installing python3-tk and tkinter-dev
- Tkinter directory being available in /usr/lib/python3.5.
The observed error was from the following file:
File "/usr/local/lib/python3.5/tkinter/init.py", line 35, in
import _tkinter # If this fails your Python may not be configured for Tk
However, when I simply ran the python from /usr/bin like /usr/bin/python3.5 from terminal, it worked for me!
In short, just ensure the python version being run from terminal has the tkinter installed and configured :)
I have Ubuntu16.04 installed on my system which comes with default python2.7 and python3.5
In my case, I was getting the same error as "ImportError: No module named '_tkinter'" for python3.5 in-spite of doing the following things:
- Installing python3-tk and tkinter-dev
- Tkinter directory being available in /usr/lib/python3.5.
The observed error was from the following file:
File "/usr/local/lib/python3.5/tkinter/init.py", line 35, in
import _tkinter # If this fails your Python may not be configured for Tk
However, when I simply ran the python from /usr/bin like /usr/bin/python3.5 from terminal, it worked for me!
In short, just ensure the python version being run from terminal has the tkinter installed and configured :)
I have Ubuntu16.04 installed on my system which comes with default python2.7 and python3.5
answered Jan 1 at 14:23
Kaustubh SableKaustubh Sable
12
12
add a comment |
add a comment |
Have you tried import Tkinter
(with a capital T) in your python program? That did it for me.
add a comment |
Have you tried import Tkinter
(with a capital T) in your python program? That did it for me.
add a comment |
Have you tried import Tkinter
(with a capital T) in your python program? That did it for me.
Have you tried import Tkinter
(with a capital T) in your python program? That did it for me.
answered Jan 1 at 14:28
OZ1SEJOZ1SEJ
4319
4319
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1033473%2fimporterror-no-module-named-tkinter-please-install-the-python3-tk-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What do you see if you run
ls -l /usr/lib/python3.5/tkinter
? You say that you manually removed it resulting in another error, what was that error?– Steve
May 8 '18 at 12:52
Where is your python installation from? Can you run
which python3
andapt list python3
?– Steve
May 8 '18 at 14:05
1
@Steve See edited question for the answers
– Martin Thoma
May 8 '18 at 14:43
2
Possible duplicate of ImportError: No named '_tkinter', please install the python3-tk package
– WinEunuuchs2Unix
Jan 1 at 14:32