python 编译安装后遇到的 pip 问题 SSLError Can‘t connect to HTTPS 、 No module named _ctypes _sqlite3

目录

Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

编译安装openssl

编译安装Python-3

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值