简体   繁体   English

Python 2.7“模块”对象没有属性“ setPenRadius”

[英]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.

相关问题 Python 2.7错误:“ AttributeError:&#39;模块&#39;对象没有属性&#39;Unit&#39;” - Python 2.7 error: “AttributeError: 'module' object has no attribute 'Unit'” AttributeError:“模块”对象没有属性“ urlopen”(Python 2.7) - AttributeError: 'module' object has no attribute 'urlopen' (Python 2.7) Python 2.7&#39;NoneType&#39;对象没有属性 - Python 2.7 'NoneType' object has no attribute Python 2.7文件“ <stdin> ”,第1行,在 <module> AttributeError:“列表”对象没有属性“用户名” - Python 2.7 File “<stdin>”, line 1, in <module> AttributeError: 'list' object has no attribute 'username' 虚拟环境中的Opencv3和Python 2.7 - AttributeError:&#39;module&#39;对象没有属性&#39;createLBPHFaceRecognizer&#39; - Opencv3 and Python 2.7 on Virtual Environment - AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer' 在 Win7 上的 python 2.7 上安装 openpyxl 报告:&#39;module&#39; 对象没有属性 &#39;packaging&#39; - Install openpyxl on python 2.7 on Win7 report: 'module' object has no attribute 'packaging' 如何解决nonetype对象在python 2.7中没有属性编码错误 - How to resolve nonetype object has no attribute encode error in python 2.7 Python 2.7 / Selenium 2 AttributeError:“ NoneType”对象没有属性“ group” - Python 2.7/Selenium 2 AttributeError: 'NoneType' object has no attribute 'group' Python 2.7:TypeError:&#39;float&#39;对象没有属性&#39;__getitem__&#39; - Python 2.7: TypeError: 'float' object has no attribute '__getitem__' python 2.7-CountVectorizer错误:AttributeError:&#39;file&#39;对象没有属性&#39;lower&#39; - python 2.7 - CountVectorizer error :AttributeError: 'file' object has no attribute 'lower'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM