亚当·伯尼尔的答案可能是正确的。似乎您有一个名为
turtle.pyPython的文件,该文件要比Python安装随附的文件先启动。
要查找这些问题:
% pythonPython 2.7.1 (r271:86832, Jan 29 2011, 13:30:16) [GCC 4.2.1 (Apple Inc. build 5664)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.path[...] # Your ${PYTHONPATH}>>> import turtle>>> turtle.__file__'/opt/local/Library/frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/turtle.pyc' # Should be under your Python installation.>>>如果您看到以下内容:
>>> import turtle>>> turtle.__file__'turtle.py'
然后,您将希望将当前工作目录中的文件
turtle.py(以及所有对应文件
turtle.pyc或
turtle.pyo文件)移开。
根据下面的评论,您将通过调用模块找到大量有关模块的信息,包括其路径名和内容
help()。例如:
>>> import turtle>>> help(turtle)



