Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82513

Re: How to import sqlite3 in my python3.4 successfully?

Date 2014-12-14 09:03 -0800
From Albert-Jan Roskam <fomcl@yahoo.com>
Subject Re: How to import sqlite3 in my python3.4 successfully?
Newsgroups comp.lang.python
Message-ID <mailman.16951.1418576759.18130.python-list@python.org> (permalink)

Show all headers | View raw


---------------------------
On Sun, Dec 14, 2014 4:06 PM CET sir wrote:

>There are two python version in my debian7, one is python2.7 the system default version, the other is python3.4 which compiled to install this way.
>
>|  apt-get  update
> apt-get  upgrade
> apt-get  install build-essential
> wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
> tar-zxvfPython-3.4.0.tgz
> cdPython-3.4.0
> mkdir/usr/local/python3.4
> ./configure--prefix=/usr/local/python3.4
> make
> make install
> ln-s/usr/local/python3.4/bin/python3.4    /usr/bin/python3.4
> ln-s/usr/local/python3.4/bin/pip3.4    /usr/bin/pip3.4|
>
>I have installed sqlite this way on my debian.
>
>|sudo apt-get  install sqlite3 libsqlite3-dev|
>
>In python2.7
>
>|root@rebuild:~#  python
>Python  2.7.3  (default,  Mar  14  2014,  11:57:14)
>[GCC4.7.2]  on linux2
>Type  "help",  "copyright",  "credits"  or  "license"  for  more information.
>>>  import  sqlite3|
>
>In python3.4
>
>|root@rebuild:~#  python3.4
>Python  3.4.0  (default,  Nov  27  2014,  13:54:17)
>[GCC4.7.2]  on linux
>Type  "help",  "copyright",  "credits"  or  "license"  for  more information.
>>>  import  sqlite3
>Traceback  (most recent calllast):
>  File  "<stdin>",  line1,  in  <module>
>  File  "/usr/local/python3.4/lib/python3.4/sqlite3/__init__.py",  line23,  in  <module>
>    from  sqlite3.dbapi2import  *
>  File  "/usr/local/python3.4/lib/python3.4/sqlite3/dbapi2.py",  line26,  in  <module>
>    from  _sqlite3import  *
>ImportError:  No  module  named'_sqlite3'|
>
>How can i import sqlite3 in my python3.4 successfully?
>

Did you get any errors after compiling? One of the things to do BEFORE you install python is sudo apt-get install libsqlite3-dev, and probably a couple more (but not for sqlite)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to import sqlite3 in my python3.4 successfully? Albert-Jan Roskam <fomcl@yahoo.com> - 2014-12-14 09:03 -0800

csiph-web