problems with python 2.7.3 on Centos with sqlite3 module

13,293

Solution 1

If you are under RHEL/centos 6, you can try this:

cp /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/

Solution 2

This will work for CentOS:

ln -s /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/

/usr/local/lib/python2.7/ is already on python's path. No need to duplicate the file or add the python's path.

Solution 3

first find:

find / -name _sqlite3.so
/usr/usr/lib/python2.6/lib-dynload/_sqlite3.so
/usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so
/usr/lib64/python2.6/lib-dynload/_sqlite3.so

next

cp /usr/local/service/python2.7/lib/python2.7/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/

this centso 6.5 python2.7.10

Share:
13,293
Tony
Author by

Tony

Senior php, python developer.

Updated on July 23, 2022

Comments

  • Tony
    Tony almost 2 years

    i'm tying to play with sqlite3 on my centos server but it reports always the same error (module installed)....

    Python 2.7.3 (default, Jun 29 2012, 19:03:18) 
    [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "sqlite3/__init__.py", line 24, in <module>
        from dbapi2 import *
      File "sqlite3/dbapi2.py", line 27, in <module>
        from _sqlite3 import *
    ImportError: No module named _sqlite3
    

    on ubuntu and so on works fine.... any ideas of what i'm missing here?


    i recompile the 2.7.3 again and it catch the sqlite3 libs well.