gpt4 book ai didi

python - 尝试在 Linux 服务器上运行 jupyter 笔记本

转载 作者:行者123 更新时间:2023-12-01 07:37:30 24 4
gpt4 key购买 nike

我尝试在我有权访问的服务器上运行 jupyter Notebook,但它一直抛出此错误:

我尝试过使用 pip3 install --user sqlite3pip install --user pysqlite2 以及一堆其他组合,这些组合一直让我陷入错误的兔子洞.

任何帮助都会很棒。

-bash-4.2$ jupyter notebook
Traceback (most recent call last):
File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
import sqlite3
File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/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 "/data/users/USER/.local/bin/jupyter-notebook", line 6, in <module>
from notebook.notebookapp import main
File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/notebookapp.py", line 86, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'

输出1:

-bash-4.2$ hostnamectl
Static hostname: SERVER_NAME
Icon name: computer-server
Chassis: server
Machine ID: 807cc73fa4ba404192edd7c64de3cf3f
Boot ID: 279d14738e2548d2b0622b399a9dfd40
Operating System: Red Hat Enterprise Linux
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.6:GA:server
Kernel: Linux 3.10.0-957.10.1.el7.x86_64
Architecture: x86-64

输出2

-bash-4.2$ yum install sqlite-devel
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Repo rhel-7-server-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/766154663321574841286633-key.pem
You need to be root to perform this command.

最佳答案

看来您安装了多个 Python。

执行以下步骤:

  1. 转到您的主目录
  2. 使用创建虚拟环境

python3.6 -m venv env

  • 激活 venv
  • 源环境/bin/activate

  • 安装 Jupyter
  • python -m pip install --upgrade pip

    python -m pip install jupyter

  • 运行 jupyter 笔记本
  • jupyter笔记本

  • 要打开笔记本,请确保将 localhost:8888 放入 putty 隧道配置中,然后在本地网络浏览器上打开 localhost:8888
  • 关于python - 尝试在 Linux 服务器上运行 jupyter 笔记本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56917052/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com