aws cli: ERROR: root: kode untuk hash md5 tidak ditemukan

13

Saat mencoba menjalankan AWS CLI, saya mendapatkan kesalahan ini:

aws
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/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.15_1/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_1/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.15_1/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_1/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.15_1/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.15_1/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.15_1/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.15_1/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.15_1/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.15_1/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.15_1/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 "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 17, in <module>
    import botocore.session
  File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 29, in <module>
    import botocore.configloader
  File "/usr/local/lib/python2.7/site-packages/botocore/configloader.py", line 19, in <module>
    from botocore.compat import six
  File "/usr/local/lib/python2.7/site-packages/botocore/compat.py", line 25, in <module>
    from botocore.exceptions import MD5UnavailableError
  File "/usr/local/lib/python2.7/site-packages/botocore/exceptions.py", line 15, in <module>
    from botocore.vendored import requests
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/utils.py", line 26, in <module>
    from .compat import parse_http_list as _parse_list_header
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/compat.py", line 7, in <module>
    from .packages import chardet
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/__init__.py", line 3, in <module>
    from . import urllib3
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/__init__.py", line 10, in <module>
    from .connectionpool import (
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 31, in <module>
    from .connection import (
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 45, in <module>
    from .util.ssl_ import (
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/util/__init__.py", line 5, in <module>
    from .ssl_ import (
  File "/usr/local/lib/python2.7/site-packages/botocore/vendored/requests/packages/urllib3/util/ssl_.py", line 2, in <module>
    from hashlib import md5, sha1, sha256
ImportError: cannot import name md5

Saya mencoba solusi dari masalah ini tetapi tidak berfungsi:

brew reinstall python@2
==> Reinstalling python@2
Error: An exception occurred within a child process:
  FormulaUnavailableError: No available formula with the name "/usr/local/opt/python@2/.brew/[email protected]"

Saya pikir itu mungkin tidak diinstal, tetapi sudah:

brew install python@2
Warning: python@2 2.7.15_1 is already installed and up-to-date
To reinstall 2.7.15_1, run `brew reinstall python@2`

Menjalankan brew doctormenunjukkan yang pythontidak disukai, tetapi menjalankan brew link pythongagal karena milik symlink python@2.

brew link python
Linking /usr/local/Cellar/python/3.7.6_1...
Error: Could not symlink Frameworks/Python.framework/Headers
Target /usr/local/Frameworks/Python.framework/Headers
is a symlink belonging to python@2. You can unlink it:
  brew unlink python@2

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Perintah yang disarankan tampaknya berputar-putar dan tidak ada yang berhasil memecahkan masalah. Saya agak macet - bagaimana saya pulih dari kesalahan ini?

Pauline
sumber
Saya sarankan Anda untuk menghapus versi itu dari sistem Anda, dan unduh AWS CLI v2 baru, yang disediakan oleh paket yang dibundel untuk mencegah dependensi seperti itu dengan Python
eez0
@ eez0 Saya dapat mencoba, tetapi saya menjalankan dalam masalah yang sama:pip uninstall awscli ERROR:root:code for hash md5 was not found.
Pauline
1
Cobabrew reinstall awscli
Doyin Olarewaju

Jawaban:

11

Mengalami masalah serupa dengan brew install python2 error ketika mencoba menggunakan pip.

Mungkin karena

python @ 2 dihapus dari homebrew / core di komit 028f11f9e:
python @ 2: delete ( https://github.com/Homebrew/homebrew-core/issues/49796 )
EOL 1 Januari 2020.

Lihat posting ini di sini https://github.com/Homebrew/homebrew-core/pull/49796 untuk rincian lebih lanjut.

Untuk memperbaikinya,

  1. Jalankan brew uninstall python@2untuk menghapus brew terinstal python @ 2 ini harus membuat python2 default kembali ke python2 datang dengan macOS.
  2. uninstall aws cli saat ini dengan menjalankan

    • sudo rm -rf /usr/local/bin/aws
    • sudo rm -rf /usr/local/aws
    • rm AWSCLIV2.pkg
  3. instal aws cli lagi dengan menjalankan

    • sudo curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
    • sudo installer -pkg AWSCLIV2.pkg -target /
  4. Jika Anda menjalankan, aws --versionAnda akan melihat itu terhubung dengan python3bukan python2.

Semoga ini bisa membantu.

Bao Yutong 鲍昱 彤
sumber
Hanya berlari brew uninstall python@2berhasil buat saya, terima kasih
Daniel Gomez Rico
brew uninstall python @ 2 bekerja untuk saya juga, terima kasih banyak :-)
Aditya Rao
0

Saya memiliki masalah yang sama setelah berlari brew install imagemagick.

Keduanya autojumpdan awsclimemberi saya kesalahan di atas.

Masalah ini disebabkan oleh konflik antara opensslyang diinstal oleh homebrew dan macOS SSL lib? Lihat di sini dan di sini

Menjalankan perintah di bawah ini memperbaikinya untuk saya

brew reinstall python@2
brew reinstall awscli
mozey
sumber