Ubuntu安装jupyter,启动出现ModuleNotFoundError: No module named ‘pysqlite2‘ 错误

2021/11/11 2:09:53

本文主要是介绍Ubuntu安装jupyter,启动出现ModuleNotFoundError: No module named ‘pysqlite2‘ 错误,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Ubuntu安装jupyter,启动出现ModuleNotFoundError: No module named 'pysqlite2' 错误

    • 错误描述
    • 错误定位
    • 解决错误
    • 后记

错误描述

Ubuntu安装jupyter,过程中并未出现错误,而在启动jupyter时出现错误:

Traceback (most recent call last):
  File "/home/brainiac/Program/python3.7/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 9, in <module>
    import sqlite3
  File "/home/brainiac/Program/python3.7/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/home/brainiac/Program/python3.7/lib/python3.7/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 "/home/brainiac/Program/python3.7/bin/jupyter-notebook", line 5, in <module>
    from notebook.notebookapp import main
  File "/home/brainiac/Program/python3.7/lib/python3.7/site-packages/notebook/notebookapp.py", line 88, in <module>
    from .services.sessions.sessionmanager import SessionManager
  File "/home/brainiac/Program/python3.7/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 12, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'

错误定位

构建Python3时缺少libsqlite3-dev依赖。
因此需要安装libsqlite3-dev后,重新编译python即可解决。

解决错误

安装libsqlite3-dev

sudo apt-get install libsqlite3-dev

安装完成后,重新编译安装即可,编译过程可以参考此博文。
重新运行jupyter,运行成功

jupyter notebook

成功运行

后记

Enjoy coding.



这篇关于Ubuntu安装jupyter,启动出现ModuleNotFoundError: No module named ‘pysqlite2‘ 错误的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程