我需要你的帮助,
如何更正错误 AttributeError: 'module' 对象没有属性 'sha1',
当我启动命令 example import random 或 import hashlib 时,我得到这样的结果
root@thinkad:~# python
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/random.py", line 49, in <module>
import hashlib as _hashlib
File "hashlib.py", line 3, in <module>
hasher = hashlib.sha1()
AttributeError: 'module' object has no attribute 'sha1'
>>> import math
>>> import hashlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "hashlib.py", line 3, in <module>
hasher = hashlib.sha1()
AttributeError: 'module' object has no attribute 'sha1'
>>>
安装一些酿造桶并进行定期清理后出现了问题。然后,node-gyp 无法为我的节点应用程序重建一些包。重新安装 python 2 对我有帮助。
在 Mac 上:
brew reinstall python@2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)