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
Its output code from PyCharm:
import sys
import tkinter
print(sys.version)
PyCharm output:
"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 2, in <module>
import tkinter
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
And same code but output for default IDLE 3.6.1
3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
Its output when i try install packages "turtle"
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:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ptr\AppData\Local\Temp\pycharm-packaging\turtle\
Someone have idea what i can do?
Please sign in to leave a comment.
Solved - i missname file.py
i'm having the same problem,can u explain how to solve this problem?
Shimba774 I have this problem too. I've solved it when i create another project with another environment or interpreter. I am sure mentioned problem is related with it. Good luck!