几个月后,我首先在终端输入jupyter notebook
,我发现了这个问题:
[W 09:00:56.905 NotebookApp] No web browser found: could not locate runnable browser.
然后我在我的命令jupyter notebook --no-browser
中添加了一些参数,它确实可以在我的浏览器中打开,但是,我无法创建一个Notebook,New
中的选项是none,就像这样:
我的终端出现了红色警报信息:
[W 09:02:35.812 NotebookApp] Config option `token` not recognized by `NotebookApp`.
[W 09:02:35.813 NotebookApp] Config option `token` not recognized by `NotebookApp`.
[I 09:02:35.870 NotebookApp] Serving notebooks from local directory: /Users/yuanxiansen
[I 09:02:35.870 NotebookApp] 0 active kernels
[I 09:02:35.870 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 09:02:35.870 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/utils/path.py:258: UserWarning: get_ipython_dir has moved to the IPython.paths module
warn("get_ipython_dir has moved to the IPython.paths module")
[E 09:02:37.613 NotebookApp] Unhandled error in API request
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/traitlets/traitlets.py", line 501, in get
value = obj._trait_values[self.name]
KeyError: 'kernel_dirs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/notebook/base/handlers.py", line 457, in wrapper
result = yield gen.maybe_future(method(self, *args, **kwargs))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/notebook/services/kernelspecs/handlers.py", line 56, in get
for kernel_name in ksm.find_kernel_specs():
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/kernelspec.py", line 128, in find_kernel_specs
for kernel_dir in self.kernel_dirs:
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/traitlets/traitlets.py", line 529, in __get__
return self.get(obj, cls)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/traitlets/traitlets.py", line 508, in get
value = self._validate(obj, dynamic_default())
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/jupyter_client/kernelspec.py", line 122, in _kernel_dirs_default
dirs.append(os.path.join(get_ipython_dir(), 'kernels'))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/utils/path.py", line 259, in get_ipython_dir
from IPython.paths import get_ipython_dir
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/__init__.py", line 48, in <module>
from .core.application import Application
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/application.py", line 24, in <module>
from IPython.core import release, crashhandler
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 121, in <module>
from IPython.utils.terminal import get_terminal_size
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/utils/terminal.py", line 27, in <module>
import backports.shutil_get_terminal_size
ImportError: No module named 'backports.shutil_get_terminal_size'//maybe this line is a big problem
[E 09:02:37.615 NotebookApp] {
"Host": "localhost:8888",
"Cookie": "Idea-8ec252f0=b3a4190a-852e-471a-9fd8-dc517a355acb",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.8,en;q=0.6",
"Referer": "http://localhost:8888/tree",
"Accept": "*/*",
"Connection": "keep-alive",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"X-Requested-With": "XMLHttpRequest"
}
[E 09:02:37.615 NotebookApp] 500 GET /api/kernelspecs (::1) 7.87ms referer=http://localhost:8888/tree
正如您所看到的,我在终端中输入了pip3 install backports.shutil_get_terminal_size
,但我收到了它存在的消息,有人能告诉我如何解决这个错误吗?
答案 0 :(得分:1)
我遇到了同样的问题。就我而言,我系统上安装的 pexpect 和 traitlets 版本比 jupyter 需要的版本旧。运行后...
sudo -H python3.9 -m pip install --upgrade --ignore-installed pexpect traitlets
Jupyter 正确启动,我不再看到错误。