当时在linux服务器上搭建python时,配置虚拟环境,创建mkvirtualenv_django时出现No module named _ssl,一整天都没有解决,最后安装配置了openssl才解决掉,给自己做个笔记,也让朋友们少踩个坑!希望可以帮到你们!
[root@hadoop01 ~]# mkvirtualenv django_env
Traceback (most recent call last):
File "/usr/local/python3.10/bin/virtualenv", line 5, in <module>
from virtualenv.__main__ import run_with_catch
File "/usr/local/python3.10/lib/python3.10/site-packages/virtualenv/__init__.py", line 1, in <module>
from .run import cli_run, session_via_cli
import ssl
File "/usr/local/python3.10/lib/python3.10/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
解决方法:
1.下载openssl
[root@chen2 opt]#wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz --no-check-certificate