Python: SQLAlchemy ImportError: No module named pysqlite2

▼魔方 西西 提交于 2019-12-11 02:13:08

问题


I'm running python 2.7.3 which I manually installed in my home directory as I don't have root access. 2.6.6 is installed on the system, but I really need 2.7. When I run the app, SQLAlchemy throws this ImportError. So I know that pysqlite2 is now sqlite3 in 2.7, so I'm guessing it's getting confused as to which version of python is installed.

Here's a traceback:

[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

回答1:


For anyone else who may have a similar problem: What are sqlite development headers and how to install them?



来源:https://stackoverflow.com/questions/14281825/python-sqlalchemy-importerror-no-module-named-pysqlite2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!