简体   繁体   中英

Python module member (turtle) not recognized

I'm beginning Python, and when I started the module part of the tutorials, it looked like modules members weren't recognized.

I'm on VSCode with python extensions like "Python" and "Python for VSCode". I'm on Windows. I reinstalled Python in C:\\Python32 to add it to the path, and went into my computer > properties > advance > variable to add it to the path again.

Example :

import os

import turtle

turtle.forward(100)

os.system("pause")

Error : Module 'turtle' has no 'forward' member

Why aren't the module member understood by VSCode ? I tried to run the code with IDLE, and it even stopped at the turtle import :

import os
import turtle

Traceback (most recent call last):

File "", line 1, in

//File should have pyshell#1 in <> in ""

 import turtle 

File "C:\\Python37-32\\turtle.py", line 5, in

 my_turtle = turtle.Turtle() # x is not a good name for a Turtle object 

AttributeError: module 'turtle' has no attribute 'Turtle'

probably your file name is turtle.py , rename it and give a try .

More information follow this Can't import turtle module in Python 2.x and Python 3.x

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM