Can't import turtle module in Python 2.x and Python 3.x

后端 未结 7 1705
时光取名叫无心
时光取名叫无心 2021-01-02 14:16

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:5         


        
7条回答
  •  离开以前
    2021-01-02 15:15

    Make sure also that you run:

    which python Then set the top of your file with that.

    #!/usr/bin/python
    import Tkinter
    from turtle import *
    

    Or if you don't have the location correct, you need to rename the file with .py Then execute with python filename.py

提交回复
热议问题