ImportError : 이름 MD5를 가져올 수 없습니다


9

여기서 무슨 일이 일어나고 있는지 모르겠지만 탄력있는 콩 줄기에 플라스크 응용 프로그램을 배포해야하지만 어떻게 든 경로를 변경하고 더 이상 python application.py를 실행할 수 없습니다.

[dotnet --info]
.NET Core SDK (reflecting any global.json):
 Version:   2.1.701
 Commit:    8cf7278aa1

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.701/

Host (useful for support):
  Version: 2.1.12
  Commit:  ccea2e606d

[brew -v]
Homebrew 2.2.0
Homebrew/homebrew-core (git revision 43ad0; last commit 2019-11-30)

나는 이미이 단계를 수행했습니다.

LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

여전히이 오류가 발생했습니다 :

File "/Users/ipchelsea/Library/Python/2.7/lib/python/site-packages/urllib3/util/ssl_.py", line 8, in <module>
    from hashlib import md5, sha1, sha256
ImportError: cannot import name md5

[brew link --force openssl]을 수행하면 아래와 같습니다.

Warning: Refusing to link macOS-provided software: openssl@1.1

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/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/2.7.16/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.16/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/2.7.16/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.16/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/2.7.16/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/2.7.16/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/2.7.16/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/2.7.16/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/2.7.16/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/2.7.16/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/2.7.16/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
Traceback (most recent call last):
  File "application.py", line 4, in <module>
    import urllib3
  File "/Users/ipchelsea/Library/Python/2.7/lib/python/site-packages/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/Users/ipchelsea/Library/Python/2.7/lib/python/site-packages/urllib3/connectionpool.py", line 29, in <module>
    from .connection import (
  File "/Users/ipchelsea/Library/Python/2.7/lib/python/site-packages/urllib3/connection.py", line 38, in <module>
    from .util.ssl_ import (
  File "/Users/ipchelsea/Library/Python/2.7/lib/python/site-packages/urllib3/util/__init__.py", line 6, in <module>
    from .ssl_ import (
  File "/Users/ipchelsea/Library/Python/2.7/lib/python/site-packages/urllib3/util/ssl_.py", line 8, in <module>
    from hashlib import md5, sha1, sha256
ImportError: cannot import name md5

답변:


14

macOS를 사용하고 있습니다. brew unlink openssl && brew reinstall python@2


감사합니다! 그것은 일했다
shalonteoh

1
brew reinstall python@2brew가 python2를 제거했다고 생각하기 때문에 여전히 확실하지 않습니다 .
oliversm

그것은 나를 위해 작동합니다. 감사!!!
마틴 포르테

4

개인적으로 파이썬 버전을 관리하기 위해 pyenv 를 사용하고 싶습니다 . 처음 에이 문제를 해결하는 방법을 brew모르고 여기에 제안 된대로 다시 설치하려고했습니다 . 그러나 나는 pyenv설치에 사용 되어서 내 오류를 해결할 수 있다는 것을 상기했다.

pyenv install -f 2.7.15

-f옵션은 시스템에 해당 버전이 이미 설치되어 있어도 해당 버전을 강제로 설치합니다. 사용 2.7.16하거나 원하는 버전을 사용해야합니다.

python-buildpyenv용도는 사용 openssl에서 라이브러리를 brew이 가능한 경우.

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.