目录
Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
pip 提示 ModuleNotFoundError: No module named '_ctypes'
ModuleNotFoundError: No module named '_sqlite3'
Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
重新编译 openssl-1.1.1、Python-3
编译安装openssl
openssl-1.1.1 https://www.openssl.org/source/openssl-1.1.1l.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz && \
tar -zxvf openssl-*.tar.gz && rm -rf openssl-*.tar.gz && \
cd openssl-* && \
./config --prefix=/usr/local/openssl && \
make -j4 && make install && \
ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl && \
ln -sf /usr/local/openssl/include/openssl /usr/include/openssl && \
ln -sf /usr/local/openssl/lib/libssl.so /usr/lib64/libssl.so && \
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf && \
ldconfig -v
编译安装Python-3
weget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tar.xz && \
tar -xvf Python-*.tar.xz -C /opt/ && rm -rf Python-*.tar.xz && \
cd Python-* && \
./configure -prefix=/usr/local/python3.7 --with-openssl=/usr/local/openssl --enable-optimizations && \
make -j4 && make install && \
ln -sf /usr/local/python3.7/bin/python3.7 /usr/bin/python3.7 && \
ln -sf /usr/local/python3.7/bin/python3.7 /usr/bin/python3 && \
ln -sf /usr/local/python3.7/bin/python3.7 /usr/bin/python && \
ln -sf /usr/local/python3.7/bin/pip3 /usr/bin/pip3 && \
ln -sf /usr/local/python3.7/bin/pip3 /usr/bin/pip && \
/usr/local/python3.7/bin/python3 -m pip install --upgrade pip && \
/usr/local/python3.7/bin/python3 -m pip install --upgrade setuptools
pip 提示 ModuleNotFoundError: No module named '_ctypes'
问题出在编译安装python前没有安装libffi-devel导致
yum install -y libffi-devel
重新编译安装python
make -j4 && make install
ModuleNotFoundError: No module named '_sqlite3'
编译前没有安装sqlite-devel
yum install -y sqlite-devel
重新编译安装python
make -j4 && make install