在linux机器上,运行django执行新建app命令python manage.py startapp learn,报错:
@H_404_3@No module named _sqlite3@H_404_3@
@H_404_3@详细错误如下: @H_404_3@
- #pythonmanage.pystartapplearn
- Traceback(mostrecentcalllast):
- File"manage.py",line10,in<module>
- execute_from_command_line(sys.argv)
- 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
- utility.execute()
- 327,153);background-color:inherit;font-weight:bold;">inexecute
- django.setup()
- File"/usr/local/lib/python2.7/site-packages/django/__init__.py",line18,153);background-color:inherit;font-weight:bold;">insetup
- apps.populate(settings.INSTALLED_APPS)
- File"/usr/local/lib/python2.7/site-packages/django/apps/registry.py",line108,153);background-color:inherit;font-weight:bold;">inpopulate
- app_config.import_models(all_models)
- File"/usr/local/lib/python2.7/site-packages/django/apps/config.py",line202,153);background-color:inherit;font-weight:bold;">inimport_models
- self.models_module=import_module(models_module_name)
- File"/usr/local/lib/python2.7/importlib/__init__.py",line37,153);background-color:inherit;font-weight:bold;">inimport_module
- __import__(name)
- 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
- 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):
- File"/usr/local/lib/python2.7/site-packages/django/db/models/base.py",153);background-color:inherit;font-weight:bold;">in__new__
- new_class.add_to_class('_Meta',Options(Meta,app_label))
- 299,153);background-color:inherit;font-weight:bold;">inadd_to_class
- value.contribute_to_class(cls,name)
- File"/usr/local/lib/python2.7/site-packages/django/db/models/options.py",line263,153);background-color:inherit;font-weight:bold;">incontribute_to_class
- self.db_table=truncate_name(self.db_table,connection.ops.max_name_length())
- File"/usr/local/lib/python2.7/site-packages/django/db/__init__.py",line36,153);background-color:inherit;font-weight:bold;">in__getattr__
- returngetattr(connections[DEFAULT_DB_ALIAS],item)
- File"/usr/local/lib/python2.7/site-packages/django/db/utils.py",line212,153);background-color:inherit;font-weight:bold;">in__getitem__
- backend=load_backend(db['ENGINE'])
- 116,153);background-color:inherit;font-weight:bold;">inload_backend
- returnimport_module('%s.base'%backend_name)
- 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)
- 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