gpt4 book ai didi

pip - 如何完全卸载jupyter

转载 作者:行者123 更新时间:2023-12-04 14:23:57 28 4
gpt4 key购买 nike

我无法打开 jupyter notebook .ipynb 文件(我可以打开 jupyter notebook,但是当我 pip 击 .ipynb 时它退出并出现未知错误)因此我想完全摆脱 jupyter 和 ipython。

我使用 sudo pip uninstall 卸载了 jupyter 和 ipython,还使用了 pip2pip3,但我仍然能够在 找到 jupyter code>/usr/local/bin/jupyter 我也可以用 jupyter 启动它。

如果我现在用 pip 重新安装 jupyter,我会得到和以前一样的错误,所以我想它总是以我仍然安装的方式启动。

那么我该如何卸载呢?只删除二进制文件?

编辑1:如果重要的话,我正在使用 python 2.7Ubuntu 16.04

编辑2:我遇到了与此基本相同的问题 pip uninstall jupyter does not work but which jupyter returns

编辑3:当我尝试打开 jupyter-notebook 时的完整错误输出:

[E 14:59:58.222 NotebookApp] Uncaught exception GET /api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008 (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Accept-Language': 'de-DE,en-US;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'X-Xsrftoken': '2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395', 'X-Requested-With': 'XMLHttpRequest', 'Host': 'localhost:8888', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb', 'Cookie': '_xsrf=2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395; username-localhost-8888="2|1:0|10:1523883578|23:username-localhost-8888|44:YjJhYjc1MjI4Y2UwNDBlMDg1ZGJkN2QyMTkzZmM5ZGU=|c9400d948f07d89cf10b581a1251394138f0f7180395bdcffd5df47bd396c189"'})
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1512, in _execute
result = yield result
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 307, in wrapper
yielded = next(result)
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/handlers.py", line 112, in get
path=path, type=type, format=format, content=content,
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/filemanager.py", line 418, in get
model = self._notebook_model(path, content=content)
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/filemanager.py", line 378, in _notebook_model
self.mark_trusted_cells(nb, path)
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/manager.py", line 502, in mark_trusted_cells
trusted = self.notary.check_signature(nb)
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 438, in check_signature
signature = self.compute_signature(nb)
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 413, in compute_signature
hmac = HMAC(self.secret, digestmod=self.digestmod)
File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 387, in _secret_default
self._write_secret_file(secret)
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 397, in _write_secret_file
with io.open(self.secret_file, 'wb') as f:
IOError: [Errno 13] Permission denied: '/home/gustav/.local/share/jupyter/notebook_secret'
[W 14:59:58.223 NotebookApp] Unhandled error
[E 14:59:58.223 NotebookApp] {
"Accept-Language": "de-DE,en-US;q=0.5",
"Accept-Encoding": "gzip, deflate",
"X-Xsrftoken": "2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395",
"X-Requested-With": "XMLHttpRequest",
"Host": "localhost:8888",
"Accept": "application/json, text/javascript, */*; q=0.01",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0",
"Connection": "keep-alive",
"Referer": "http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb",
"Cookie": "_xsrf=2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395; username-localhost-8888=\"2|1:0|10:1523883578|23:username-localhost-8888|44:YjJhYjc1MjI4Y2UwNDBlMDg1ZGJkN2QyMTkzZmM5ZGU=|c9400d948f07d89cf10b581a1251394138f0f7180395bdcffd5df47bd396c189\""
}
[E 14:59:58.223 NotebookApp] 500 GET /api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008 (127.0.0.1) 37.67ms referer=http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb

最佳答案

修复 jupyter 错误

您有权限问题:

IOError: [Errno 13] Permission denied: '/home/gustav/.local/share/jupyter/notebook_secret'

卸载不会有帮助,至少不会直接卸载。您可以通过在终端中输入此命令来修复它:

mkdir -p ${HOME}/.local/share/jupyter

这将修复由于 .local/share/jupyter 目录不存在而导致的错误。

完全卸载jupyter

如果您无法解决权限问题,这里是从太空中对 jupyter 进行核攻击的最简单的一组命令:

pip install pip-autoremove
pip-autoremove jupyter -y

根据我刚刚进行的一些测试,您可能还必须在最后运行:

pip-autoremove jupyter-core -y

双击打开.ipynb文件

您无法通过双击打开仅使用 vanilla Jupyter 的 .ipynb。这是设计使然(也可以说是设计缺陷,但是嗯)。您可以使用 nbopen 添加此功能项目。

要在 Ubuntu 上安装,只需在终端中运行以下命令:

python3 -m pip install nbopen
python3 -m nbopen.install_xdg

不过我没有测试过这个,因为我没有运行 Linux。

如何以“正常”方式打开 .ipynb 文件

您无法通过双击打开仅使用 vanilla Jupyter 的 .ipynb。这是设计使然(也可以说是设计缺陷,但是嗯)。

相反,您必须在 Jupyter 文件管理器中打开文件,运行方式如下:

  1. 打开一个新的终端窗口(在 Ubuntu 中,您只需输入 Ctrl+Alt+T)。

  2. 通过运行 jupyter notebook 启动笔记本服务器

  3. 这应该会在您的互联网浏览器中自动打开一个指向 Jupyter 文件管理器的新窗口。如果没有,您的终端中会有一行内容类似

    Copy/paste this URL into your browser when you connect for the first time, to login with a token:

    在这种情况下,只需将以下 URL 复制到浏览器窗口的地址栏中,然后按回车键即可。

  4. 您现在应该有一个显示 Jupyter 文件管理器的浏览器窗口。使用文件管理器导航到您要打开的 .ipynb,然后单击它即可。

诚然有 pip 令人费解,尤其是一开始。我相信 Jupyter 以这种方式设置的原因可以追溯到其基于服务器的架构,以及设计团队希望它能够轻松/无缝地部署到远程计算机上这一事实。

关于pip - 如何完全卸载jupyter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49857212/

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