0

I already read tons of replies and I think I focused the problem but I miss the last step.

I am running Python 3.7 on Linux and did the update of sqlite to version 3.35.4 downloading and compiling the code. After that, to make the last version visible inside Python I add a line with vi in a configuration file but unfortunately I am not able now to recover or remember the line neither the file. Anyway everything worked and making

import sqlite3
sqlite3.sqlite_version

I get me the correct sqlite version and the Python code run correctly.

The problem is that running the same Python code with cron I noticed that the old version of sqlite is used. How I can tell to cron to run the updated version of sqlite with Python?

4
  • 1
    Please show how you run Python scripts in your Terminal and also how you are starting the Python script in your crontab. Apr 19, 2021 at 14:23
  • Terminal : python mycode.py where python links to 3.7 version. In crontab: * * * * * python /home/user/code_dir/mycode.py where crontab takes the same Python version but an older sqlite (the standard one that comes with Python 3.7 and not the updated one). I tried in crontab to set some PATH and PYTHONPATH, maybe in the wrong way, without success. Apr 19, 2021 at 15:33
  • In the Terminal, run type python. That will give you the full path to the Python interpreter which works. Use that same full path in crontab Apr 19, 2021 at 16:13
  • No success unfortunately. The problem is still there. Apr 19, 2021 at 17:40

1 Answer 1

0
!/bin/bash
cd /home/ec2-user/sqlite-autoconf-3380100/
./configure --prefix=/usr/local/
sudo make
sudo make install
sudo mv  /usr/bin/sqlite3 /usr/bin/sqlite3.bak
sudo ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
sudo echo export LD_LIBRARY_PATH="/usr/local/lib">> ~/.bashrc
source ~/.bashrc
cd /home/ec2-user/test
/usr/bin/python3 python.py

please have a look at above file which is my sh file for running python script.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.