0

although there are several questions, that cover the same problem, none of these questions/answers solved my problem. I'm using PyCharm 2022.3.2 Community to learn Python. I'm trying to get Turtle to run:

from turtle import Turtle, Screen

timmy = Turtle()
timmy.color("coral")
timmy.forward(100)
timmy.right(90)
timmy.forward(100)

screen = Screen()
screen.exitonclick()

This is not working, PyCharm quits with:

/usr/bin/python3 /home/zwette/PycharmProjects/Day-18-Start/main.py 
Traceback (most recent call last):
  File "/home/zwette/PycharmProjects/Day-18-Start/main.py", line 1, in <module>
    from turtle import Turtle, Screen
ModuleNotFoundError: No module named 'turtle'

Process finished with exit code 1

I already changed Python from venv to systems Python, but turtle is still not found. My system is running under Linux Mint 21 Cinnamon. Any ideas?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
Calimero
  • 11
  • 2
  • This has **nothing to do with** Pycharm and everything to do with the Python installation that you are using (presumably, the built-in one that comes with Linux Mint, which **does not include** `turtle`, `tkinter` or anything else graphical). Please see https://stackoverflow.com/questions/6084416 - I am out of duplicate close votes at the moment. – Karl Knechtel Mar 03 '23 at 18:44
  • Actually, it looks like PyCharm causes a slightly different problem here; please see https://stackoverflow.com/questions/65252348. – Karl Knechtel Mar 03 '23 at 19:25
  • @KarlKnechtel I already saw this one, but I had the hope that there is a solution where I do not have to compile PyCharm from scratch. – Calimero Mar 03 '23 at 19:54
  • @KarlKnechtel I ended up dowloading the source from JetBrains, extracted it to my programs folder and configured it to the systems Python interpreter rather than the virtual environments Python interpreter. – Calimero Mar 05 '23 at 06:25
  • Before working around the problem, were you able to import `tkinter`? How about `_tkinter`? – Karl Knechtel Mar 05 '23 at 23:10
  • No, even though `python3-tk` was installed, this module could not be found. `_tkinter` I did never try. – Calimero Mar 08 '23 at 06:05
  • Pycharm creates virtual environments for projects; these will not necessarily update even if the system Python is updated (by installing `python3-tk`). The solution is to re-create the virtual environment afterwards. – Karl Knechtel Apr 25 '23 at 21:17

0 Answers0