MacOS 通过 Brew 升级完 Python 打开终端出现一堆错误。

2020-03-26 13:19:46 +08:00
 abelzyp

打开终端就出现如下错误,求帮助:

ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 ERROR:root:code for hash sha256 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 sha256 ERROR:root:code for hash sha384 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 sha384 ERROR:root:code for hash sha512 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 sha512 ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 ERROR:root:code for hash sha256 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 sha256 ERROR:root:code for hash sha384 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 sha384 ERROR:root:code for hash sha512 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.13/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 sha512

4495 次点击
所在节点    Python
32 条回复
TimePPT
2020-03-26 13:30:30 +08:00
卸了重装吧
另外,建议用 pyenv 直接管理 Python 版本吧,想咋折腾咋折腾
wangyzj
2020-03-26 13:34:09 +08:00
哈哈
你犯了大忌了
misaka19000
2020-03-26 13:35:25 +08:00
降低 openssl 的版本
Hanggi
2020-03-26 13:36:56 +08:00
放弃 py 吧,真的是一坨浆糊,不想用。
oahebky
2020-03-26 13:50:20 +08:00
重装警告
重装警告
重装警告
Ccbeango
2020-03-26 14:24:36 +08:00
用 py 版本管理工具多好啊。
abelzyp
2020-03-26 14:43:48 +08:00
@wangyzj 对于你这种在一旁冷笑,站着说话不腰疼的这类人。我只能对你说:大佬,我是真不知道这是啥报错啊?救救孩子吧😭
wangyzj
2020-03-26 14:52:13 +08:00
环境变量改成 /Library/Frameworks/Python.framework/Versions 下面的试试
littleylv
2020-03-26 14:52:34 +08:00
jiejiss
2020-03-26 15:03:03 +08:00
brew install openssl
brew link openssl --force
brew uninstall python
brew install python --with-brewed-openssl
abelzyp
2020-03-26 15:03:13 +08:00
我刚才照着这个帖子 https://www.jianshu.com/p/98383a7688a5 删除了 Python3.7 和 2.7,还是不行。求指教啊?
我现在 ls /Library/Frameworks/Python.framework/Versions 只有一个 Current,剩下啥都没了。
WoodenRobot
2020-03-26 15:06:32 +08:00
[]( https://zhuanlan.zhihu.com/p/117457048) 试试这个,我之前遇到过
abelzyp
2020-03-26 15:08:54 +08:00
@jiejiss 在执行 brew uninstall python 的时候,错误如下:
Error: Refusing to uninstall /usr/local/Cellar/python/2.7.13
because it is required by macvim and vim, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies python

我是应该按照提示进行么?
Cuo
2020-03-26 15:09:27 +08:00
可以换用 pyenv 管理 python 版本,将 pyenv 下的 python 路径设为全局变量后就可以无视 brew 安装的 python 了。
wangyzj
2020-03-26 15:09:46 +08:00
@abelzyp 有 timemachine 吗?
littleylv
2020-03-26 15:09:53 +08:00
我想问一下你一开始有 brew update 么
Cuo
2020-03-26 15:11:03 +08:00
@abelzyp 你在删除的是系统自带的 python,如果按照提示强制删除的话,之后可能出现依赖问题
abelzyp
2020-03-26 15:16:10 +08:00
@littleylv 执行 brew install python --with-brewed-openssl 的时候报错:Error: invalid option: --with-brewed-openssl,这块是命令不对么?我着实不太了解这块。
abelzyp
2020-03-26 15:17:44 +08:00
@Cuo 那可否装回来啊?我看通过 10 楼的最后一条命令,应该是装回来的意思吧?
abelzyp
2020-03-26 15:18:04 +08:00
@littleylv 有的,这块有什么联系么?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/656355

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX