报错:AttributeError: 'module' object has no attribute 'xxx'
程序员文章站
2022-03-26 19:32:40
...
问题: import pysam的时候,
Traceback (most recent call last):
File "test.py", line 2, in <module>
import pysam
File "/home/wangjing/Downloads/NA12878/image/pysam.py", line 10, in <module>
AttributeError: 'module' object has no attribute 'AlignmentFile'
可能1. mutual top-level imports
http://*.com/questions/1250103/attributeerror-module-object-has-no-attribute
可能2. py文件命名
- 命名py脚本时,不要与python预留字,模块名等相同**
- 删除该库的.pyc文件(因为py脚本每次运行时均会生成.pyc文件;在已经生成.pyc文件的情况下,若代码不更新,运行时依旧会走pyc,所以要删除.pyc文件),重新运行代码;或者找一个可以运行代码的环境,拷贝替换当前机器的.pyc文件即可**
下一篇: metaæ ç¾
推荐阅读
-
AttributeError: module ‘community‘ has no attribute ‘best_partition‘ 问题解决方法
-
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
-
【Tensorflow】Linux下Tensorflow报错:AttributeError: module ‘tensorflow‘ has no attribute ‘xxxx‘
-
AttributeError: 'module' object has no attribute 'main'
-
AttributeError: module 'sklearn' has no attribute 'linear_model'
-
解决Keras报错AttributeError: 'NoneType' object has no attribute 'inbound_nodes'
-
AttributeError: ‘NoneType‘ object has no attribute ‘origin‘解决办法
-
AttributeError: ‘set‘ object has no attribute ‘append‘解决办法
-
'module' object has no attribute
-
AttributeError: 'GridSearchCV' object has no attribute 'grid_scores_'