解决No module named _sqlite3的问题

在linux机器上,运行django执行新建app命令python manage.py startapp learn,报错:

@H_404_3@No module named _sqlite3

@H_404_3@

@H_404_3@详细错误如下:

@H_404_3@

[python] view plain copy
  1. #pythonmanage.pystartapplearn
  2. Traceback(mostrecentcalllast):
  3. File"manage.py",line10,in<module>
  4. execute_from_command_line(sys.argv)
  5. File"/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py",line353,153);background-color:inherit;font-weight:bold;">inexecute_from_command_line
  6. utility.execute()
  7. 327,153);background-color:inherit;font-weight:bold;">inexecute
  8. django.setup()
  9. File"/usr/local/lib/python2.7/site-packages/django/__init__.py",line18,153);background-color:inherit;font-weight:bold;">insetup
  10. apps.populate(settings.INSTALLED_APPS)
  11. File"/usr/local/lib/python2.7/site-packages/django/apps/registry.py",line108,153);background-color:inherit;font-weight:bold;">inpopulate
  12. app_config.import_models(all_models)
  13. File"/usr/local/lib/python2.7/site-packages/django/apps/config.py",line202,153);background-color:inherit;font-weight:bold;">inimport_models
  14. self.models_module=import_module(models_module_name)
  15. File"/usr/local/lib/python2.7/importlib/__init__.py",line37,153);background-color:inherit;font-weight:bold;">inimport_module
  16. __import__(name)
  17. File"/usr/local/lib/python2.7/site-packages/django/contrib/auth/models.py",line4,248);line-height:18px;list-style-position:outside;">fromdjango.contrib.auth.base_userimportAbstractBaseUser,BaseUserManager
  18. File"/usr/local/lib/python2.7/site-packages/django/contrib/auth/base_user.py",line49,153);background-color:inherit;font-weight:bold;">classAbstractBaseUser(models.Model):
  19. File"/usr/local/lib/python2.7/site-packages/django/db/models/base.py",153);background-color:inherit;font-weight:bold;">in__new__
  20. new_class.add_to_class('_Meta',Options(Meta,app_label))
  21. 299,153);background-color:inherit;font-weight:bold;">inadd_to_class
  22. value.contribute_to_class(cls,name)
  23. File"/usr/local/lib/python2.7/site-packages/django/db/models/options.py",line263,153);background-color:inherit;font-weight:bold;">incontribute_to_class
  24. self.db_table=truncate_name(self.db_table,connection.ops.max_name_length())
  25. File"/usr/local/lib/python2.7/site-packages/django/db/__init__.py",line36,153);background-color:inherit;font-weight:bold;">in__getattr__
  26. returngetattr(connections[DEFAULT_DB_ALIAS],item)
  27. File"/usr/local/lib/python2.7/site-packages/django/db/utils.py",line212,153);background-color:inherit;font-weight:bold;">in__getitem__
  28. backend=load_backend(db['ENGINE'])
  29. 116,153);background-color:inherit;font-weight:bold;">inload_backend
  30. returnimport_module('%s.base'%backend_name)
  31. File"/usr/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py",line39,153);background-color:inherit;font-weight:bold;">raiseImproperlyConfigured("Errorloadingeitherpysqlite2orsqlite3modules(triedinthatorder):%s"%exc)
  32. django.core.exceptions.ImproperlyConfigured:Errorloadingeitherpysqlite2orsqlite3modules(triedinthatorder):Nomodulenamed_sqlite3


@H_404_3@解决

@H_404_3@1,首先安装 sqlite-devel

@H_404_3@yum install sqlite-devel

@H_404_3@2,重新编译安装Python

@H_404_3@./configure

@H_404_3@make

make install

相关文章

安装 在Windows上安装SQLite。 访问官网下载下Precompliled Binaries for Windows的两个压缩包。 创建s...
一、安装 下载地址:http://www.sqlite.org/download.html 将Precompiled Binaries for Windows下的包下...
实例: 会员信息管理 功能:1.查看数据库 2.清空数据库 3.增加会员 4.删除会员 5.更新会员 6.查找会员  ...
关于SQLite SQLite是一个轻量的、跨平台的、开源的数据库引擎,它的在读写效率、消耗总量、延迟时间和整...