[英]Python 2.7 'module' object has no attribute 'setPenRadius'
I am trying to run Princeton University's htree.py which imports stddraw.py . 我正在尝试运行普林斯顿大学的htree.py ,其中导入stddraw.py 。 Although I have both files saved locally in the same file, I getting an error saying that 'module' object has no attribute 'setPenRadius' although it is clearly defined in the stddraw file. 尽管我将两个文件都本地保存在同一个文件中,但是我收到一个错误消息,尽管“ stddraw”文件中明确定义了“ module”对象没有属性“ setPenRadius”。 Any help on what I am doing wrong here would be greatly appreciated. 对于我在这里做错的任何帮助,将不胜感激。
stddraw v0.2
Traceback (most recent call last):
File "htree.py", line 42, in <module>
main()
File "htree.py", line 37, in main
stddraw.setPenRadius(0.0)
AttributeError: 'module' object has no attribute 'setPenRadius'
I think that you have a different module with the same name in your path that is being loaded instead of the stddraw.py
that you linked to. 我认为您正在加载的路径中有一个具有相同名称的不同模块,而不是您链接到的stddraw.py
。 Try redownloading the stddraw.py module that you want and rename it to something else, eg stddrawprinceton.py
. 尝试重新下载所需的stddraw.py模块,并将其重命名为其他名称,例如stddrawprinceton.py
。 To use the module with the new name, change the import statement in htree.py
to: 要使用新名称的模块,请将htree.py
的import语句htree.py
为:
import stddrawprinceton as stddraw
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.