Python:属性错误:模块#39;对象没有属性'AddReference'? [英] Python: AttributeError: 'module' object has no attribute 'AddReference'?

查看:50
本文介绍了Python:属性错误:模块#39;对象没有属性'AddReference'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用clr.AddReference和clr.AddReferenceToFile导入程序集,但python(2.7)一直出现以下错误:

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    clr.AddReference("UnityEngine")
AttributeError: 'module' object has no attribute 'AddReference'

有人能告诉我如何修复此问题吗?

推荐答案

我遇到过这个问题。 有一个名为clr的包,而pythonnet包的别名也是clr。 所以我删除了clrby";pip uninstall clr";,然后安装了pythonnetby‘pip install pythonnet’。 最后,一切运行正常。

这篇关于Python:属性错误:模块#39;对象没有属性&#39;AddReference&#39;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆