Python: SQLAlchemy ImportError: No module named py

2019-07-20 13:30发布

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条回答
神经病院院长
2楼-- · 2019-07-20 14:21

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

查看更多
登录 后发表回答