簡體   English   中英

無法識別Python模塊成員(turtle)

[英]Python module member (turtle) not recognized

我正在開始使用Python,當我開始教程的模塊部分時,似乎模塊成員未被識別。

我在VSCode上使用python擴展,例如“ Python”和“ Python for VSCode”。 我在Windows上。 我在C:\\ Python32中重新安裝了Python以將其添加到路徑,然后進入我的計算機>屬性>高級>變量以再次將其添加到路徑。

范例:

import os

import turtle

turtle.forward(100)

os.system("pause")

錯誤:模塊“ turtle”沒有“ forward”成員

為什么VSCode無法理解模塊成員? 我試圖用IDLE運行代碼,它甚至在turtle導入時停止了:

import os
import turtle

追溯(最近一次通話):

文件“”,第1行,位於

//文件應在“>”的<>中具有pyshell#1

 import turtle 

文件“ C:\\ Python37-32 \\ turtle.py”,第5行,在

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

AttributeError:模塊“ turtle”沒有屬性“ Turtle”

可能您的文件名是turtle.py,將其重命名並嘗試一下。

請按照以下詳細信息進行操作: 無法在Python 2.x和Python 3.x中導入turtle模塊

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM