ImportError: No module named tkinter. Mac OS Terminal
I have created a Tkinter window in a python script. The script runs perfectly in the python IDLE and generates the GUI. However, when I run this file outside of the IDLE by clicking on it on my Desktop, the terminal responds with ImportError: No module named tkinter. Even though tkinter is installed as its a default module when python is installed. Any help is much appreciated. Im working on python 3.7
python-3.x macos tkinter module terminal
add a comment |
I have created a Tkinter window in a python script. The script runs perfectly in the python IDLE and generates the GUI. However, when I run this file outside of the IDLE by clicking on it on my Desktop, the terminal responds with ImportError: No module named tkinter. Even though tkinter is installed as its a default module when python is installed. Any help is much appreciated. Im working on python 3.7
python-3.x macos tkinter module terminal
add a comment |
I have created a Tkinter window in a python script. The script runs perfectly in the python IDLE and generates the GUI. However, when I run this file outside of the IDLE by clicking on it on my Desktop, the terminal responds with ImportError: No module named tkinter. Even though tkinter is installed as its a default module when python is installed. Any help is much appreciated. Im working on python 3.7
python-3.x macos tkinter module terminal
I have created a Tkinter window in a python script. The script runs perfectly in the python IDLE and generates the GUI. However, when I run this file outside of the IDLE by clicking on it on my Desktop, the terminal responds with ImportError: No module named tkinter. Even though tkinter is installed as its a default module when python is installed. Any help is much appreciated. Im working on python 3.7
python-3.x macos tkinter module terminal
python-3.x macos tkinter module terminal
asked Nov 18 '18 at 22:04
MorganMorgan
41
41
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Make sure your default python , the one that the terminal calls has tkinter installed.
So run 'python --version'
in the terminal and if that yields 3.7 then your default python is 3.7.
Now try to import tkinter using that same python version.
open the terminal and run python
then run import tkinter as tk
If that does not yield an error saying that the module was not found then most probably you are running the executable with the wrong permissions.
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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%2fstackoverflow.com%2fquestions%2f53365915%2fimporterror-no-module-named-tkinter-mac-os-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Make sure your default python , the one that the terminal calls has tkinter installed.
So run 'python --version'
in the terminal and if that yields 3.7 then your default python is 3.7.
Now try to import tkinter using that same python version.
open the terminal and run python
then run import tkinter as tk
If that does not yield an error saying that the module was not found then most probably you are running the executable with the wrong permissions.
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
add a comment |
Make sure your default python , the one that the terminal calls has tkinter installed.
So run 'python --version'
in the terminal and if that yields 3.7 then your default python is 3.7.
Now try to import tkinter using that same python version.
open the terminal and run python
then run import tkinter as tk
If that does not yield an error saying that the module was not found then most probably you are running the executable with the wrong permissions.
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
add a comment |
Make sure your default python , the one that the terminal calls has tkinter installed.
So run 'python --version'
in the terminal and if that yields 3.7 then your default python is 3.7.
Now try to import tkinter using that same python version.
open the terminal and run python
then run import tkinter as tk
If that does not yield an error saying that the module was not found then most probably you are running the executable with the wrong permissions.
Make sure your default python , the one that the terminal calls has tkinter installed.
So run 'python --version'
in the terminal and if that yields 3.7 then your default python is 3.7.
Now try to import tkinter using that same python version.
open the terminal and run python
then run import tkinter as tk
If that does not yield an error saying that the module was not found then most probably you are running the executable with the wrong permissions.
answered Nov 18 '18 at 22:11
MedoAlmasryMedoAlmasry
649
649
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
add a comment |
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
Thanks for the answer. It turns out it was actually python 2 it was calling. Do you know how to change it from the 2.7 to 3.7?
– Morgan
Nov 18 '18 at 22:14
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
stackoverflow.com/a/18425592/2224647
– MedoAlmasry
Nov 18 '18 at 22:17
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
I have followed the instructions on that link, and it has now set the version to 3.7. But when I click on the py file to run it, it still comes up with the same tkinter error
– Morgan
Nov 18 '18 at 22:36
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
Have you tried installing tkinter in python 2 as well?!
– MedoAlmasry
Nov 20 '18 at 17:48
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53365915%2fimporterror-no-module-named-tkinter-mac-os-terminal%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