Python:SQLAlchemy-importorror:没有名为pysqlite2的模块

Python:SQLAlchemy-importorror:没有名为pysqlite2的模块,python,sqlite,sqlalchemy,pysqlite,Python,Sqlite,Sqlalchemy,Pysqlite,我正在运行Python2.7.3,我手动将其安装在我的主目录中,因为我没有根目录访问权限。系统上安装了2.6.6,但我确实需要2.7。当我运行应用程序时,SQLAlchemy抛出了这个可怕的消息。所以我知道pysqlite2现在是2.7中的sqlite3,所以我猜它对于安装了哪个版本的python感到困惑 以下是回溯: [11/Jan/2013:16:04:57] ENGINE Listening for SIGHUP. [11/Jan/2013:16:04:57] ENGINE Listeni

我正在运行Python2.7.3,我手动将其安装在我的主目录中,因为我没有根目录访问权限。系统上安装了2.6.6,但我确实需要2.7。当我运行应用程序时,SQLAlchemy抛出了这个可怕的消息。所以我知道pysqlite2现在是2.7中的sqlite3,所以我猜它对于安装了哪个版本的python感到困惑

以下是回溯:

[11/Jan/2013:16:04:57] ENGINE Listening for SIGHUP.
[11/Jan/2013:16:04:57] ENGINE Listening for SIGTERM.
[11/Jan/2013:16:04:57] ENGINE Listening for SIGUSR1.
[11/Jan/2013:16:04:57] ENGINE Bus STARTING
[11/Jan/2013:16:04:57] ENGINE Starting up DB access
[11/Jan/2013:16:04:57] ENGINE Error in 'start' listener <bound method SAEnginePlugin.start of <giraffe.sa.saplugin.SAEnginePlugin object at 0x239c6d0>>
Traceback (most recent call last):
  File "/assetuser/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/process/wspbus.py", line 197, in publish
    output.append(listener(*args, **kwargs))
  File "/assetuser/giraffe_server/giraffe/sa/saplugin.py", line 35, in start
    self.sa_engine = create_engine('sqlite:///giraffe.db', echo=False)
  File "/assetuser/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 338, in create_engine
    return strategy.create(*args, **kwargs)
  File "/assetuser/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 64, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/assetuser/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 286, in dbapi
    raise e
ImportError: No module named pysqlite2

CherryPy Checker:
dir is an absolute path, even though a root is provided.
section: [/Project]
root: '/assetuser/giraffe_server/static'
dir: '/assetuser/Project'

[11/Jan/2013:16:04:57] ENGINE Started monitor thread 'Autoreloader'.
[11/Jan/2013:16:04:57] ENGINE Started monitor thread '_TimeoutMonitor'.
[11/Jan/2013:16:04:57] ENGINE Serving on 0.0.0.0:8080
[11/Jan/2013:16:04:57] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
  File "/assetuser/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/process/wspbus.py", line 235, in start
    self.publish('start')
  File "/assetuser/lib/python2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/process/wspbus.py", line 215, in publish
    raise exc
ChannelFailures: ImportError('No module named pysqlite2',)

[11/Jan/2013:16:04:57] ENGINE Bus STOPPING
[11/Jan/2013:16:04:57] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8080)) shut down
[11/Jan/2013:16:04:57] ENGINE Stopped thread 'Autoreloader'.
[11/Jan/2013:16:04:57] ENGINE Stopped thread '_TimeoutMonitor'.
[11/Jan/2013:16:04:57] ENGINE Shutting down DB access
[11/Jan/2013:16:04:57] ENGINE Bus STOPPED
[11/Jan/2013:16:04:57] ENGINE Bus EXITING
[11/Jan/2013:16:04:57] ENGINE Bus EXITED
[11/Jan/2013:16:04:57]发动机正在监听信号。
[11/Jan/2013:16:04:57]发动机正在监听SIGTERM。
[11/Jan/2013:16:04:57]发动机正在监听信号1。
[11/Jan/2013:16:04:57]发动机总线启动
[11/Jan/2013:16:04:57]发动机启动数据库访问
[11/Jan/2013:16:04:57]在“启动”侦听器中出现发动机错误
回溯(最近一次呼叫最后一次):
文件“/assetuser/lib/python2.7/site packages/CherryPy-3.2.2-py2.7.egg/CherryPy/process/wspbus.py”,第197行,在publish中
append(侦听器(*args,**kwargs))
文件“/assetuser/giraffe_server/giraffe/sa/saplugin.py”,第35行,开头
self.sa_engine=创建_engine('sqlite:///giraffe.db,echo=False)
文件“/assetuser/lib/python2.7/site packages/sqlalchemy/engine/_init__.py”,第338行,在create_引擎中
返回策略。创建(*args,**kwargs)
文件“/assetuser/lib/python2.7/site packages/sqlalchemy/engine/strategies.py”,第64行,在create中
dbapi=方言\ cls.dbapi(**dbapi\参数)
dbapi中的文件“/assetuser/lib/python2.7/site packages/sqlalchemy/dialogs/sqlite/pysqlite.py”,第286行
提高e
ImportError:没有名为pysqlite2的模块
樱桃色棋盘格:
dir是一个绝对路径,即使提供了根。
章节:[/项目]
根目录:'/assetuser/giraffe_server/static'
目录:'/assetuser/Project'
[11/Jan/2013:16:04:57]引擎已启动监视器线程“Autoreloader”。
[11/Jan/2013:16:04:57]引擎已启动监视器线程“\u TimeoutMonitor”。
[11/Jan/2013:16:04:57]发动机在0.0.0.0:8080上工作
[11/Jan/2013:16:04:57]由于启动侦听器出错,发动机关闭:
回溯(最近一次呼叫最后一次):
文件“/assetuser/lib/python2.7/site packages/CherryPy-3.2.2-py2.7.egg/CherryPy/process/wspbus.py”,第235行,开头
self.publish('start')
文件“/assetuser/lib/python2.7/site packages/CherryPy-3.2.2-py2.7.egg/CherryPy/process/wspbus.py”,第215行,在publish中
加薪
ChannelFailures:ImportError('没有名为pysqlite2'的模块,)
[11/Jan/2013:16:04:57]发动机总线停止
[11/Jan/2013:16:04:57]引擎HTTP服务器cherrypy._cpwsgi_Server.CPWSGIServer(('0.0.0.0',8080))关闭
[11/Jan/2013:16:04:57]引擎已停止线程“Autoreloader”。
[11/Jan/2013:16:04:57]引擎已停止线程“\u TimeoutMonitor”。
[11/Jan/2013:16:04:57]发动机关闭数据库访问
[11/Jan/2013:16:04:57]发动机总线停止
[11/Jan/2013:16:04:57]发动机总线退出
[11/Jan/2013:16:04:57]发动机总线退出

对于其他可能有类似问题的人:

您可以包含完整的回溯,以避免让我们猜测。我的猜测是:
sqlite3
库没有编译,
sqlalchemy
只有在未找到
sqlite3
的情况下才会返回到
pysqlite2
。您需要安装
sqlite dev
软件包或等效软件。是的,您需要在编译python时安装sqlite开发文件,否则sqlite 3将不可用。好的,这是有意义的。所以我可以安装
sqlite-dev
python包,或者在编译时安装sqlite?你能详细说明一下你所说的sqlite开发文件是什么意思吗?谢谢大家。一些linux发行版将库分为头包和库二进制包。只有在编译包时才需要这些头文件,因此并不总是安装它们。这些头包的后缀通常是
-dev
-devel
。您应该查找名为
sqlite-dev
libsqlite-dev
等的库。。。这些名称因发行版而异。对于可能有类似问题的其他人: