Getting the sqlite3 module running in a Python 3 virtualenv is a piece of cake… if you know what to do.
22.01.2015
Using virtualenvs ? Does that look familiar to you?
$ workon py3
(py3)$ python
Python 3.4.2 (default, Jan 22 2015, 16:27:36)
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
Fear not, it's easy to fix… (on FreeBSD)
(py3)$ tar xzf /usr/local/src/distfiles/python/Python-3.4.2.tar.xz
(py3)$ cd Python-3.4.2/Modules
(py3)$ cp /usr/ports/databases/py-sqlite3/files/setup3.py setup.py
(py3)$ CFLAGS="-I/usr/local/include" python setup.py build
(py3)$ python setup.py install
(py3)$ python
Python 3.4.2 (default, Jan 22 2015, 16:27:36)
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>>
Piece of cake.