Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Python 3.4 with sqlite3

Tags:

python

sqlite

I have compiled SQLite3 3.8.6 and installed it to ${HOME}/opt with:

LDFLAGS="-L${HOME}/opt/lib" CFLAGS="-L${HOME}/opt/include" ./configure --prefix=$HOME/opt
make && make install

I am now trying to compile Python 3.4.2 to use this version instead of the version installed for the entire system. I do not have root access on this system. To compile Python, I am using:

LDFLAGS="-L${HOME}/opt/lib" CFLAGS="-L${HOME}/opt/include" ./configure --prefix=$HOME/opt
make && make install

I was able to compile Python 3.3.5 with my newer version if SQLite3, but these same steps don't seem to work for me for 3.4.2.

How can I compile Python 3.4.2 to include my version of SQLite 3.8.6 which is located in ${HOME}/opt?

Thanks.

EDIT: It compiles & installs OK except for the fact that is using the older, system version of sqlite3 instead of the version that I compiled & installed myself.

like image 841
jftuga Avatar asked Oct 08 '14 15:10

jftuga


People also ask

What is the correct way to install sqlite3 in Python?

Step 1 − Go to SQLite download page, and download precompiled binaries from Windows section. Step 2 − Download sqlite-shell-win32-*. Step 3 − Create a folder C:\>sqlite and unzip above two zipped files in this folder, which will give you sqlite3.

For what purpose sqlite3 is used in Python?

SQLite is used to develop embedded software for devices like televisions, cell phones, cameras, etc. It can manage low to medium-traffic HTTP requests. SQLite can change files into smaller size archives with lesser metadata. SQLite is used as a temporary dataset to get processed with some data within an application.


1 Answers

There is also the option of pre-linking your custom Python build with your own-built sqlite3. (I had the same issue: the custom python was using the system-provided sqlite3, completely ignoring the sqlite3 I built).

Prefix your configure and make commands with:

LD_RUN_PATH=$HOME/opt/lib configure LDFLAGS="-L$HOME/opt/lib" CPPFLAGS="-I$HOME/opt/include" …
LD_RUN_PATH=$HOME/opt/lib make

so that the built python3 by default is linked to your sqlite3. This worked for me.

like image 90
tzot Avatar answered Oct 04 '22 11:10

tzot