1. ホーム
  2. パイソン

変なエラーです。OpenSSL.SSL.Error。[('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac') ]。

2022-02-25 21:51:12
<パス

最近pytorchを勉強しているので、まず環境を整える必要があったのですが、その間に質問にあるようなエラーが発生し、さらに不思議なことにopencvを自分でインストールしなければならないときにも同じエラーが発生しました(上記はすべてサーバ上で行いました)、とんでもないです 。
まず、エラーメッセージを見てください。

Traceback (most recent call last):
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 294, in recv_into
    return self.connection.recv_into(*args, **kwargs)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into
    self._raise_ssl_error(self._ssl, result)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1614, in _raise_ssl_error
    raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 179, in main
    status = self.run(options, args)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 315, in run
    resolver.resolve(requirement_set)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/resolve.py", line 131, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 334, in prepare_linked_ requirement
    progress_bar=self.progress_bar
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 878, in unpack_url
    progress_bar=progress_bar
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 702, in unpack_http_url
    progress_bar)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 946, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 639, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/utils/hashes.py", line 62, in check_against_chunks
    for chunk in chunks:
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 607, in written_chunks
    for chunk in chunks:
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/utils/ui.py", line 159, in iter
    for x in it:
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 596, in resp_read
    decode_content=False):
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 494, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 442, in read
    data = self._fp.read(amt)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/home/zqzhu/anaconda3/lib/python3.7/http/client.py", line 447, in read
    n = self.readinto(b)
  File "/home/zqzhu/anaconda3/lib/python3.7/http/client.py", line 491, in readinto
    n = self.fp.readinto(b)
  File "/home/zqzhu/anaconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 309, in recv_into
    return self.recv_into(*args, **kwargs)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 309, in recv_into
    return self.recv_into(*args, **kwargs)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 309, in recv_into
    return self.recv_into(*args, **kwargs)
  [Previous line repeated 7 more times]
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 294, in recv_into
    return self.connection.recv_into(*args, **kwargs)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1814, in recv_into
    self._raise_ssl_error(self._ssl, result)
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1639, in _raise_ssl_error
    _raise_current_error()
  File "/home/zqzhu/anaconda3/lib/python3.7/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac')]



それから自分でgoogleで調べて、それからいろいろなボツボツとした解決策、最後のものは試さず、私の解決策は、うまくいくまでインストールをやり続けることでした。
最後に、同じようなエラーに遭遇した戦士の皆さん、解決策を教えていただければ幸いです!!!