How to get _sqlite3.so file?

I installed Python 2.6.2 .. I did it "locally" since I do not have root privileges. With this version of Python, I wanted to use a module called "sqlite3" (in earlier versions it is called "pysqlite"). Theoretically, I should have used this module without any problems, since it should be enabled by default in the Python version in question. However, I have some problems. When I type:

from sqlite3 import *

I get:

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

As I said, a possible cause of this problem is that the module tries to import _sqlite3 and fails, so it does not find _sqlite3.so. This explanation is confirmed by the fact that I do not have the _sqlite3.so file in the directory "/home/verrtex/opt/lib/python2.6/lib-dynload". So this is the problem that I have to solve (I have to get this file in this directory).

I found out that to solve this problem I need to "install sqlite3 and recompile Python". I also found that the problem can be solved by "creating from the source and moving the library to / usr / lib / python 2.5 / lib-dynload /".

, . python "sqlite3" sqlite- ? , sqlite, . ? , root. ? python? root ?

, SQLite, , :

./configure
make
make install

Python. ? ( Python )?

, wile.

P.S. - CentOS 5.3 (Final).

+3
2

sys.path , Python 2.6.2, , .

, SQLite (sqlite-dev - ), Python. , , - .

: .

2: , :

from module import *

:

from module import what_i_need
import module2
+1

, , , -, .

CentOS 6.3 (Final) python2.6.

python2.7.3 , . (_sqlite3.so /path/to/python2.7.3/lib/python2.7/lib-dynload python2.7.3. , python2.7, sqlite-autoconf-3071502.tar.gz.)

/path/to/python2.6/lib/python2.6/lib-dynload/_sqlite3.so python2.7. python-:

>>> import sqlite3

>>> import _sqlite3

.

, , , python script. sqlite-devel (sudo yum install sqlite-devel ), python2.7.3. python script . ! .

0

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


All Articles