How to build sqlite for Python 2.4?

I would like to use the pysqlite interface between a Python database and sdlite. I already have Python and SQLite on my computer. But I have problems installing pysqlite. During installation, the following error message appears:

Error: gcc command failed with exit status 1

As I understand it, problems arise because the version of my Python is 2.4.3, and SQLite is integrated into Python with 2.5. However, I also found out that you can build sqlite for Python 2.4 (perhaps with some tricks).

Does anyone know how to build sqlite for Python 2.4?

As another option, I can try installing a higher version of Python. However, I do not have root privileges. Does anyone know what would be the easiest way to solve the problem (build SQLite for Python 2.4 or install a newer version of Python)? I should mention that I would not want to overwrite the old version of Python.

Thanks in advance.

0
source share
4 answers

You can download and install Python in your home directory.

$ cd
$ mkdir opt
$ mkdir downloads
$ cd downloads
$ wget http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tgz
$ tar xvzf Python-2.6.2.tgz
$ cd Python-2.6.2
$ ./configure --prefix=$HOME/opt/ --enable-unicode=ucs4
$ make
$ make install

Then (if you are using bash) in your .bash_profile do

export PATH=$HOME/opt/bin/:$PATH
export PYTHONPATH=$HOME/opt/lib:$HOME/opt/lib/site-packages:$PYTHONPATH

Then send the file to make it available

$ cd
$ source .bash_profile
$ python -V

python -V python. , , setup.py Python ( , ), ~/opt/lib/python2.x/site-packages.

+1

pysqlite , cd , , :

$ tar xzf pysqlite-2.5.5.tar.gz 

( , sudo ):

$ cd pysqlite-2.5.5
$ python2.4 setup.py install

:

  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/pysqlite2/test/py25tests.py", line 48
    with self.con:
            ^
SyntaxError: invalid syntax

, py 2.5 (with 2.4! -). , :

$ python2.4 -c'import pysqlite2'
$

Mac OS X 10.5, python2.4, Python 2.5.

, , - , sqlite? msg...?

+1

root, Python , PATH. , , sqlite Python.

, Python, .

0

I had the same issue with gcc crashing with Ubuntu Karmic. I fixed this by installing the python-dev package. In my case, I am working with python2.4, so I installed the python2.4-dev package. The python-dev package should work on python2.6.

0
source

Source: https://habr.com/ru/post/1718583/


All Articles