Linux部署pip装jupyter后notebook报错
Posted 白-胖-子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux部署pip装jupyter后notebook报错相关的知识,希望对你有一定的参考价值。
ModuleNotFoundError: No module named '_sqlite3'
[python@C8-196 web36]$ jupyter notebook help
Traceback (most recent call last):
File "/home/python/.pyenv/versions/3.6.15/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 9, in <module>
import sqlite3
File "/home/python/.pyenv/versions/3.6.15/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/home/python/.pyenv/versions/3.6.15/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 "/home/python/.pyenv/versions/3.6.15/bin/jupyter-notebook", line 5, in <module>
from notebook.notebookapp import main
File "/home/python/.pyenv/versions/3.6.15/lib/python3.6/site-packages/notebook/notebookapp.py", line 83, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/home/python/.pyenv/versions/3.6.15/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 12, in <module>
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
- 一看这么多库没装好,那肯定是python没装好
- 完全删除之前安装的python
- 重新安装python
- 重新安装ipython和jupyter
[python@C8-196 web36]$ pyenv versions
pyenv: version `3.6.15' is not installed (set by /home/python/projects/web36/.python-version)
system
[python@C8-196 web36]$ pyenv install 3.6.15
Installing Python-3.6.15...
Installed Python-3.6.15 to /home/python/.pyenv/versions/3.6.15
[python@C8-196 web36]$ pyenv local 3.6.15
[python@C8-196 web36]$ pyenv version
3.6.15 (set by /home/python/projects/web36/.python-version)
[python@C8-196 web36]$ pip install ipython jupyter
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting ipython
Downloading https://mirrors.aliyun.com/pypi/packages/27/2b/547334a7763cb0e0016c2756fbda7b0eb862524e2860ec3f0913d8c432a5/ipython-7.16.2-py3-none-any.whl (782kB)
100% |████████████████████████████████| 788kB 78.8MB/s
Collecting jupyter
……
[python@C8-196 web36]$ jupyter notebook --ip=0.0.0.0 --no-browser
[I 20:36:26.781 NotebookApp] Writing notebook server cookie secret to /home/python/.local/share/jupyter/runtime/notebook_cookie_secret
[I 20:36:26.962 NotebookApp] Serving notebooks from local directory: /home/python/projects/web36
[I 20:36:26.963 NotebookApp] Jupyter Notebook 6.4.6 is running at:
[I 20:36:26.963 NotebookApp] http://C8-196:8888/?token=1ad0e35c3f25fc667f89f464ddf8bb006ee668415f7e5532
[I 20:36:26.963 NotebookApp] or http://127.0.0.1:8888/?token=1ad0e35c3f25fc667f89f464ddf8bb006ee668415f7e5532
[I 20:36:26.963 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:36:26.967 NotebookApp]
To access the notebook, open this file in a browser:
file:///home/python/.local/share/jupyter/runtime/nbserver-37673-open.html
Or copy and paste one of these URLs:
http://C8-196:8888/?token=1ad0e35c3f25fc667f89f464ddf8bb006ee668415f7e5532
or http://127.0.0.1:8888/?token=1ad0e35c3f25fc667f89f464ddf8bb006ee668415f7e5532
[I 20:36:57.380 NotebookApp] 302 GET /?token=1ad0e35c3f25fc667f89f464ddf8bb006ee668415f7e5532 (10.0.0.1) 0.750000ms
总结:折腾那些库非常讨厌,还不如赶快重装。
- 用pyenv装真是快呀,好开心!
以上是关于Linux部署pip装jupyter后notebook报错的主要内容,如果未能解决你的问题,请参考以下文章
Linux Ubuntu下Jupyter Notebook的安装