我刚刚安装了 Python 3.9.1 和 pip 21.0.1,但无法使 Jupyter Notebook 工作。我可以打开它,但无法创建新的 Python 3 笔记本(500:内部服务器错误)。 我尝试过 stackoverflow 上建议的不同解决方案,但似乎没有任何效果。有人能指出我这里出了什么问题的正确方向吗?
[E 12:31:46.068 NotebookApp] Uncaught exception GET /notebooks/Untitled1.ipynb?kernel_name=python3 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled1.ipynb?kernel_name=python3', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/web.py", line 1704, in _execute
result = await result
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 775, in run
yielded = self.gen.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 95, in get
self.write(self.render_template('notebook.html',
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/base/handlers.py", line 516, in render_template
return template.render(**ns)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
{% extends "page.html" %}
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/templates/page.html", line 154, in top-level template code
{% block header %}
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/templates/notebook.html", line 115, in block "header"
{% for exporter in get_frontend_exporters() %}
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 40, in get_frontend_exporters
for name in get_export_names():
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 141, in get_export_names
e = get_exporter(exporter_name)(config=config)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 102, in get_exporter
if getattr(exporter(config=config), 'enabled', True):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 325, in __init__
super().__init__(config=config, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 114, in __init__
self._init_preprocessors()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 491, in _init_preprocessors
conf = self._get_conf()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 509, in _get_conf
if conf_path.exists():
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1407, in exists
self.stat()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1221, in stat
return self._accessor.stat(self)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter/nbconvert/templates/conf.json'
[E 12:31:46.091 NotebookApp] {
"Host": "localhost:8888",
"Connection": "keep-alive",
"Sec-Ch-Ua": "\"Google Chrome\";v=\"87\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"87\"",
"Sec-Ch-Ua-Mobile": "?0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Dest": "document",
"Referer": "http://localhost:8888/tree",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cookie": "_xsrf=2|85632aaa|64c82af63fd0966e14c03d95ba64a8a9|1612261353; username-localhost-8888=\"2|1:0|10:1612265499|23:username-localhost-8888|44:OTNlN2QxZGM3NTNiNDQwMDg5NmNkNjhlNmU4ODA4YTQ=|0d8e7a82c04f0bd92a53e19f819e7204c81853c25412c8bbb8f60e5e95ebccf2\""
}
[E 12:31:46.091 NotebookApp] 500 GET /notebooks/Untitled1.ipynb?kernel_name=python3 (::1) 262.630000ms referer=http://localhost:8888/tree
提前非常感谢您。
最佳答案
在 conda promt 中使用此命令:
conda install nbconvert=5.4.1
并将 torrnado 降级至版本 5
如果问题没有消失,只需更新 jupyter
conda update jupyter
这对我有用
关于python - 创建新的 jupyter 笔记本 : 500: Internal Server Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66008996/