python3 下没办法运行sqlalc

发布时间:2019-09-27 07:09:51编辑:auto阅读(1740)

    [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:


    Traceback (most recent call last):

      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]# 


关键字