0

I was trying to learn python on macbook pro, macos catalina v10.15.3 I was just trying to run:

import turtle
t = turtle.Pen()
t.forward(100)

but pycharm gave me this:

Traceback (most recent call last):
  File "/Users/djtriestolearn/PycharmProjects/Tryturtle/001.py", line 1, in <module>
    import turtle
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/turtle.py", line 107, in <module>
    import tkinter as TK
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

I tried my best already but still don't know what's wrong, somebody help please.

damaredayo
  • 1,048
  • 6
  • 19
  • 2
    If the answer you posted was meant to be an edit to the question, please remove the answer and paste that code into your question: [Edit]. – Carcigenicate Mar 12 '20 at 12:31
  • 2
    Does this answer your question? [Tkinter: "Python may not be configured for Tk"](https://stackoverflow.com/questions/5459444/tkinter-python-may-not-be-configured-for-tk) – asachet Mar 12 '20 at 12:33
  • You will have to install tkinter. https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter – Subham Mar 12 '20 at 12:35

1 Answers1

0

You seem to not have tkinter installed, on MacOS this should be fixed by running

brew install python --with-tcl-tk

Reference: Why my Python installed via home brew not include Tkinter

damaredayo
  • 1,048
  • 6
  • 19