PyCharm and turtle

I have a problem with PyCharm. I start learning python with PyCharm and I want write some with turtle package. When i try execute this code

import turtle

bob = turtle.Turtle()

I have that message:

"C:\Program Files\Python36\python.exe" C:/Users/Ptr/Desktop/python/Proj_1/Gui.py
Traceback (most recent call last):
  File "C:/Users/Ptr/Desktop/python/Proj_1/Gui.py", line 1, in <module>
    import turtle
  File "C:\Program Files\Python36\lib\turtle.py", line 107, in <module>
    import tkinter as TK
  File "C:\Users\Ptr\Desktop\python\tkinter.py", line 3, in <module>
    okno = tkinter.Tk()
AttributeError: module 'tkinter' has no attribute 'Tk'

Process finished with exit code 1 

When I try execute that code using IDLE all works. In PyCharm I try install turtle in project:

Python>Project Interpreter

but all time I have same error:

Collecting turtle
  Using cached turtle-0.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Ptr\AppData\Local\Temp\pycharm-packaging\turtle\setup.py", line 40
        except ValueError, ve:
        except ValueError, ve:
                         ^
    SyntaxError: invalid syntax

    ----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Ptr\AppData\Local\Temp\pycharm-packaging\turtle\
  enter code here

1 answer

  • answered 2018-01-12 01:29 ds_secret

    You don't pip turtle. Turtle is a built-in python package. You just say import turtle.