我需要你的帮助,如何更正错误AttributeError:“模块”对象没有属性“ sha1”,当我启动命令示例import random或import hashlib时,我得到了这样的结果root@thinkad:~# pythonPython 2.7.3 (default, Jan 2 2013, ...

我需要你的帮助,
如何更正错误AttributeError:“模块”对象没有属性“ sha1”,
当我启动命令示例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'
>>>
提前帮助..thakns
解决方法:
看起来您有一个名为hashlib.py的文件,该文件妨碍了解释器查找标准的hashlib模块.
沃梦达教程
本文标题为:linux-python错误“ AttributeError:’模块’对象没有属性’sha1’”


基础教程推荐
猜你喜欢
- python-如何安装libhdf5-dev? (没有yum,rpm或apt-get) 2023-11-11
- 用10分钟,搭建图像处理编程环境,0失败!(python语言,windows系统) 2023-09-05
- 在Centos7 部署Python3 + Django + Nginx + Uwsgi 2023-09-04
- Python列表内存重新分配问题 2023-11-11
- 13行python代码实现对微信进行推送消息的示例代码 2022-08-30
- 进程--python 2023-09-04
- python使用pandas读写excel文件的方法实例 2022-08-30
- Python基础学习之函数和代码复用详解 2022-09-02
- Python pywin32实现word与Excel的处理 2022-09-03
- Python_多进程 2023-09-03