I'm trying to get a working version of Python 3.7 on CentOS, and the sticking point seems to be the built-in sqlite3
module.
I'm building Python as follows (using a Dockerfile here for reproducibility):
FROM centos:7.6.1810
RUN yum update -y
RUN yum install -y epel-release
RUN yum install -y https://centos7.iuscommunity.org/ius-release.rpm
RUN yum install -y python34u python34u-pip
RUN yum install -y python35u python35u-pip
RUN yum install -y python36u python36u-pip
# Python3.7 is not currently available from RHEL, EPEL, or IUS repos so download and compile it
RUN yum install -y gcc openssl-devel bzip2-devel libffi-devel make
ARG PY37_VERSION=3.7.6
RUN cd /usr/src && curl https://www.python.org/ftp/python/${PY37_VERSION}/Python-${PY37_VERSION}.tgz | tar -xz &&\
cd Python-${PY37_VERSION} && LD_RUN_PATH=/usr/lib ./configure --enable-optimizations && make -j4 altinstall &&\
rm -rf /usr/src/Python-${PY37_VERSION}
RUN cd /tmp && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.7 get-pip.py
When I fire up the container and try to import the sqlite3
module, I get a library error:
[root@ccea19dd0dc6 /]# python3.7 -c 'import sqlite3'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
Is a solution for this known?