在 mac 系统上使用hashlib 无法引入

[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import hashlib

ERROR:root:code for hash md5 was not found.

Traceback (most recent call last):

File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in

globals()[__func_name] = __get_hash(__func_name)

File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor

raise ValueError('unsupported hash type ' + name)

ValueError: unsupported hash type md5

ERROR:root:code for hash sha1 was not found.

Traceback (most recent call last):

File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in

globals()[__func_name] = __get_hash(__func_name)

File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor

raise ValueError('unsupported hash type ' + name)

ValueError: unsupported hash type sha1

ERROR:root:code for hash sha224 was not found.

Traceback (most recent call last):

File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in

globals()[__func_name] = __get_hash(__func_name)

File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor

raise ValueError('unsupported hash type ' + name)

ValueError: unsupported hash type sha224```

## 求解!

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐