[Tutor] Ubuntu 14.04 + Python 3.4.1 (pyvenv) + sqlite3
Peter Otten
__peter__ at web.de
Thu Sep 25 22:32:24 CEST 2014
Juan Christian wrote:
> So, I'm coding a software using Flask and sqlite3 on Ubuntu 14.04, I read
> that on Python 3.4.1, sqlite3 is default, but when I try to 'import
> sqlite3' I get:
>
> Traceback (most recent call last):
> File "flaskr.py", line 5, in <module>
> import sqlite3
> File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in
> <module>
> from sqlite3.dbapi2 import *
> File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 26, in <module>
> from _sqlite3 import *
> ImportError: No module named '_sqlite3'
>
>
> I'm running this code in a virtualenv using pyvenv.
>
> pip list (inside venv):
> Flask (0.10.1)
> itsdangerous (0.24)
> Jinja2 (2.7.3)
> MarkupSafe (0.23)
> pip (1.5.6)
> requests (2.4.1)
> setuptools (5.8)
> Werkzeug (0.9.6)
>
> Using Python 3.4.1
But not the one provided by the distribution, I presume? When you compiled
your Python, did you not get a message like
[...]
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline zlib
To find the necessary bits, look in setup.py in detect_modules() for the
module's name.
[...]
?
> The code is question is an example code from Flask doc, here:
> http://flask.pocoo.org/docs/0.10/tutorial/dbinit/#tutorial-dbinit
>
> I already installed 'libsqlite3-dev' (apt-get).
So after
$ sudo apt-get install libsqlite3-dev
Did you invoke
$ ./configure
$ make
again? The output should have changed slightly:
[...]
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_ssl _tkinter readline
zlib
[...]
> I don't knwo what to do!
Btw, I think this is off-topic for the tutor mailing list which is supposed
to help with basic usage of Python.
More information about the Tutor
mailing list