【发布时间】:2020-06-17 10:00:02
【问题描述】:
我用python3 -m venv env创建了一个virtualenv,
激活env。 which python 和 python --version 确认我的环境处于活动状态并正在运行 Python 3.6.1。然后我用pip install django 安装了django。然后django-admin startproject project这个命令创建了一个项目但是返回如下:
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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
然后我跑了
cd project
django-admin startapp account
同样的事情,创建了应用但返回了同样的错误/警告。
我注意到python2.7 在这个错误中出现了很多。当我激活env 并进入交互式控制台时,它显示它正在运行 python 3.6,不确定这里发生了什么。这些命令正在做他们应该做的事情,但抛出了这个错误,所以甚至不确定这是否是我应该担心的事情?谢谢你的帮助。
编辑:我觉得我已经创建了 python3 虚拟环境并设置了 django 项目很多次都没有问题。最近部署了我的第一个项目,我想也许我可能在我的机器上搞砸了?我看到与此错误相关的其他问题,请参阅 ssl...
我按照这里的建议尝试了brew unlink openssl ERROR:root:code for hash md5 was not found - not able to use any hg mercurial commands,但没有奏效。
最后很抱歉标题措辞不佳,我不得不尝试用 150 个字符来传达问题。
【问题讨论】:
-
which python会告诉你source env/bin/activate是否有效。 -
@KeithJohnHutchison 不知道这一点,但它返回
/Users/justin/Desktop/social/env/bin/python所以它使用环境 -
python --version会确认你激活了哪个版本的python -
@KeithJohnHutchison
Python 3.6.1... 似乎这个错误遍布整个互联网。我见过的解决方案都没有帮助,但看起来像是 python 问题而不是 django 问题? -
返回
pip 20.0.2 from /Users/justin/Desktop/social/env/lib/python3.6/site-packages/pip。尝试使用 pip3 创建一个新的环境/项目,没有效果。将尝试升级python,感谢您到目前为止的帮助。
标签: python django virtualenv