问题:启动jupyter报错
命令行输入:jupyter notebook
报错:
Traceback (most recent call last): File "/usr/local/lib/python3.6/sitepackages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
import sqlite3
File "/usr/local/lib/python3.6/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.6/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/usr/local/lib/python3.6//Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_sqlite3.cpython-37m-darwin.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /usr/local/lib/python3.6//Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_sqlite3.cpython-37m-darwin.so
Expected in: /usr/lib/libsqlite3.dylib
in /usr/local/lib/python3.6//Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/_sqlite3.cpython-37m-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 86, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/usr/local/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
解决办法
试了好多方法,最终还是解决了,开心
1安装sqlite-devel
yum install sqlite-devel -y
重新编译python
tar -zxvf Python-3.6.6.tgz
cd Python-3.6.6
./configure --prefix=/usr/local/python3.6.0
./configure --with-ssl
make && make install
重启jupyter notebook
提示:
Running as root is not recommended. Use --allow-root to bypass
然后执行:
[......]$ jupyter notebook --generate-config --allow-root
Overwrite /root/.jupyter/jupyter_notebook_config.py with default config? [y/N]y
Writing default config to:/root/.jupyter/jupyter_notebook_config.py
打开配置文件
gedit /root/.jupyter/jupyter_notebook_config.py
找到下面这一行
#c.NotebookApp.allow_root = False
去掉注释,将False改成True
c.NotebookApp.allow_root = True
保存后重新启动jupyter
参考:1、Python3报错ImportError: No module named pysqlite2
2、Running as root is not recommended. Use --allow-root to bypass