3

I have installed python version 3.4 on CentOS 2.6

and I also installed Django 1.8.

Then I try to create Django application like below.

$django-admin.py startproject mysite

$cd mysite
$python3 manage.py startapp poll

I got some error. How can I overcome this situation. Thanks in advance.

Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 31, in <module>
from pysqlite2 import dbapi2 as Database
ImportError: No module named 'pysqlite2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 33, in <module>
from sqlite3 import dbapi2 as Database
...
ImportError: No module named '_sqlite3'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
...
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'
Raja Simon
  • 10,126
  • 5
  • 43
  • 74
eachone
  • 557
  • 3
  • 11
  • 28
  • possible duplicate of [ImportError: No module named 'pysqlite2' when running tests in Python 3 Ubuntu](http://stackoverflow.com/questions/29022473/importerror-no-module-named-pysqlite2-when-running-tests-in-python-3-ubuntu) – Vlad Schnakovszki Jun 24 '15 at 08:52
  • Did you install the sqlite3 database and its python interface? – Freek Wiekmeijer Jun 24 '15 at 09:16
  • already I had read the article, it doesn't give any solution to me. – eachone Jun 24 '15 at 09:19
  • Opps, I did not installed sqlite3. I think it preinstalled on CentOS. Thanks, I will try to install sqllite3. – eachone Jun 24 '15 at 09:21
  • I have installed sqlite3. But I got same error messages. – eachone Jun 24 '15 at 10:21
  • Please **clarify** the CentOS version you are using and how you have tried to install the dependencies. **NB:** SQLIte comes pre bundled with Python so I'm *quite* surprised this isn't working "out of the box" for you. – James Mills Jun 24 '15 at 10:41
  • OS Version is CentOS 6.4. You are right. SQLite was pre bundled. – eachone Jun 24 '15 at 10:47

2 Answers2

3

runing sudo apt-get install python-sqlite does the trick for me

yanik
  • 798
  • 11
  • 33
0

I appended "PYTHONVERSION=3.5" just below line "VERSION=3.5" in the Makefile and recompiled. It worked.