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/Setup
modify the Setup file - Find the SSL configuration and uncomment it, as shown below. Then save and exit
- Recompile
make
sudo make install