sqlite in 2.7 on redhat 6

Larry Martell larry.martell at gmail.com
Thu Jun 15 10:14:14 EDT 2017


On Thu, Jun 15, 2017 at 9:55 AM, Peter Otten <__peter__ at web.de> wrote:
> Larry Martell wrote:
>
>> On Thu, Jun 15, 2017 at 8:56 AM, Mark Summerfield via Python-list
>> <python-list at python.org> wrote:
>>> On Thursday, June 15, 2017 at 1:47:00 PM UTC+1, Larry.... at gmail.com
>>> wrote:
>>>> I am trying to use sqlite
>>>>
>>>> $ python2.7
>>>> Python 2.7.10 (default, Feb 22 2016, 12:13:36)
>>>> [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
>>>> Type "help", "copyright", "credits" or "license" for more information.
>>>> >>> import _sqlite3
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>> ImportError: No module named _sqlite3
>>>>
>>>> It's there at:
>>>> /opt/rh/python27/root/usr/lib64/python2.7/lib-dynload/_sqlite3.so but
>>>> that is not in my path.
>>>>
>>>> I tried adding /opt/rh/python27/root/usr/lib64/python2.7/lib-dynload/
>>>> to my path and then it fails with:
>>>>
>>>> ImportError: libpython2.7.so.1.0: cannot open shared object file: No
>>>> such file or directory
>>>>
>>>> Isn't sqlite part of the standard lib? Shouldn't this just work?
>
> On linux the system sqlite3 is used.

I tried building and installing sqlite from source and that did not
solve the problem.

>
>>>
>>> Try:
>>>
>>>>>> import sqlite3 # no leading underscore
>>
>> import sqlite3
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/usr/local/lib/python2.7/sqlite3/__init__.py", line 24, in
>>   <module>
>>     from dbapi2 import *
>>   File "/usr/local/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
>>     from _sqlite3 import *
>> ImportError: No module named _sqlite3
>
> Is that a Python version that you compiled yourself?

No I installed it with pip install python2.7

> When the compilation
> finishes you get a list of missing modules. Usually the problem are missing
> header files. On Debian you can install the corressponding xxx-dev packages,
> e. g.
>
> $ sudo apt-get install libsqlite3-dev
>
> for libsqlite3. I don't know what the Redhat equivalent is.
>
> PS: There may also be a command like
>
> $ sudo apt-get build-dep python2.7
>
> to install all build dependencies for the system Python which tend to be the
> same as that for a custom Python version.



More information about the Python-list mailing list