天天看点

python3 下没办法运行sqlalchemy ?

[root@localhost python]# python3 router.py 

Traceback (most recent call last):

  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 337, in dbapi

    from sqlite3 import dbapi2 as sqlite  # try 2.5+ stdlib name.

  File "/usr/local/lib/python3.6/sqlite3/__init__.py", line 23, in <module>

    from sqlite3.dbapi2 import *

  File "/usr/local/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>

    from _sqlite3 import *

ModuleNotFoundError: No module named '_sqlite3'

During handling of the above exception, another exception occurred:

  File "router.py", line 2, in <module>

    from db import *

  File "/home/ming/python/db.py", line 11, in <module>

    db_engine = create_engine('sqlite:///:memory:', echo = False) 

  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py", line 391, in create_engine

    return strategy.create(*args, **kwargs)

  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 80, in create

    dbapi = dialect_cls.dbapi(**dbapi_args)

  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 339, in dbapi

    raise e

  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 334, in dbapi

    from pysqlite2 import dbapi2 as sqlite

ModuleNotFoundError: No module named 'pysqlite2'

[root@localhost python]# 

本文转自 帅枫小明 51CTO博客,原文链接:http://blog.51cto.com/576642026/1983270,如需转载请自行联系原作者