ImportError: No module named 'pysqlite2' when running tests in Python 3 Ubuntu

后端 未结 2 606
遇见更好的自我
遇见更好的自我 2021-01-04 22:01

Some background: we have a codebase written in Python 3 that uses Pyramid and the SqlAlchemy ORM to persist to a mysql database. To write tests for our classes using the ORM

2条回答
  •  梦毁少年i
    2021-01-04 22:28

    Running Debian Buster, I discovered the same problem with python3.6, even though, python3.5 successfully imported sqlite3. And even though the sqlite3 module was installed and should have been available to python3.6. My solution was to run

    export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.6/lib-dynload
    

    For some reason I have not yet determined, the module directory for python3.6 does not get loaded correctly for sqlite3. This solution worked both inside and outside of virtual environments.

提交回复
热议问题