Why doesn't my python see pysqlite?

I would like to have an interface between Python and sqlite. Both are installed on the machine. I had an old version of Python (2.4.3). Therefore, pysqlite was not enabled by default. Firstly, I tried to solve this problem by installing pysqlite, but I failed. My second attempt to solve the problem was to install a new version of Python. I do not have root privileges on the machine. So I installed it locally. The new version of Python is (2.6.2). As far as I know, this version should contain pysqlite by default (and now it is called "sqlite3", not "pysqlite2", as before).

However, if I type:

from sqlite3 import *

I get:

Traceback (most recent call last):  
  File "<stdin>", line 1, in <module>  
  File "/home/verrtex/opt/lib/python2.6/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/home/verrtex/opt/lib/python2.6/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3

, , , "from blablabla import *":

Traceback ( ):
"", 1, ImportError: blablabla

, python -, pysqlite, . - , , ?

P.S. CentOS 5.3 (Final).

+1
2

Windows, _sqlite3.pyd C:\Python26\DLLs. * nix , /usr/lib/python2.6/lib-dynload/_sqlite3.so. , , PYTHONPATH .

, , , , ; Python _sqlite3.so,

import sys
sys.path.append("/path/to/my/libs")

, , PYTHONPATH .bashrc .

+1

"slite3.py" ( , sqlite3/__init__.py, import sqlite3 , import _sqlite3 , _sqlite3.so. python2.6/lib-dynload Python. ld , ( , , .bashrc). lib-dynload? ? , LD ( ), .. env|grep LD ?

+1

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


All Articles