Hashlib.py Report a problem related to opanssl

When I was using scapy, I found that he would call hashlib.py, but it blew up with an error, I went to the source code to locate the error and found that it was related to openssl, so I checked to see if I had openssl locally and found that it was executable. So what should I do to fix the error now?

Reported errors:
root@s32g399ardb3:/home/karl/cross_compile/Send_packet# python3 Dpi_send.py
Traceback (most recent call last):
File “/home/karl/cross_compile/Send_packet/hashlib.py”, line 245, in
globals()[__func_name] = __get_hash(__func_name)
File “/home/karl/cross_compile/Send_packet/hashlib.py”, line 123, in __get_builtin_constructor
raise ValueError('unsupported hash type ’ + name)
ValueError: unsupported hash type md5
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “Dpi_send.py”, line 1, in
from scapy.all import Ether,Dot1Q,sendp
File “/home/karl/cross_compile/Send_packet/scapy/all.py”, line 10, in
from scapy.base_classes import *
File “/home/karl/cross_compile/Send_packet/scapy/base_classes.py”, line 19, in
import random
File “/home/karl/cross_compile/Send_packet/random.py”, line 46, in
from hashlib import sha512 as _sha512
File “/home/karl/cross_compile/Send_packet/hashlib.py”, line 247, in
import logging
ModuleNotFoundError: No module named ‘logging’

Location of error reported in hashlib.py:
for __func_name in __always_supported:
# try them all, some may not work due to the OpenSSL
# version not supporting that algorithm.
globals()[__func_name] = __get_hash(__func_name)
except ValueError:
import logging
logging.exception(‘code for hash %s was not found.’, __func_name)

Check local openssl:
root@s32g399ardb3:/home/karl/cross_compile/Send_packet# openssl

Why is this happening? Logging is a standard python module it should not be missing.

Being able to run the openssl command is mot the sane as python have openssl shared libraries loaded.

Does import ssl work on your python?