Skip to content Skip to sidebar Skip to footer

Can't Import Turtle Module In Python 2.x And Python 3.x

I want to play with turtle module in Python. But when i do import turtle module, i've the following error: $ python Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] on li

Solution 1:

You've called a script turtle.py, which is shadowing the turtle module in the standard library. Rename it.

Solution 2:

You can fix this problem by installing the python-tk package.

sudo apt-get install python3-tk

Solution 3:

I had the same problem but I found answer: "Rename it!" and it worked. anyways don't use 'import turtle'. Use 'from turtle import *'.

Solution 4:

I was unable to locate any file with turtle.py so I uninstalled Python and reinstalled a 64 bit version from Python.org. This time the program ran after I typed the following two lines of code into the terminal (black screen).

import turtle

shelly=turtle.Turtle()

Of course your turtle can be called other names and not necessarily shelly.

Solution 5:

before installing try using:

from turtle import *

g=Turtle()

begin_fill()

g.forward(100)

check out if this working or not(there is space between import and asterick sign)

Post a Comment for "Can't Import Turtle Module In Python 2.x And Python 3.x"