Python3.8 error No module named _ssl solution under Ubuntu

Today, after setting up the python3.8.1 environment on the Ubuntu server, the following error occurred during operation ImportError: No module named '_ssl'. After reading a lot of explanations, the following methods were summarized.

1. Check whether the openssl and libssl-dev packages are installed

sudo apt-get update
sudo apt-get install openssl
sudo apt-get install libssl-dev

2. Recompile the ssl module

  • In the decompression directory of the python tar package, execute and vi Modules/Setupmodify the Setup file
  • Find the SSL configuration and uncomment it, as shown below. Then save and exit
    Insert picture description here
  • Recompile
make
sudo make install

3. Try again to see if the test is normal

Insert picture description here

Guess you like

Origin blog.csdn.net/DearestFriend/article/details/108752637