簡體   English   中英

如何在 mac 上安裝 jupyter notebook?

[英]How to install jupyter notebook on mac?

我想在我安裝了jupyter3.6jupyterlab的 Mac 上運行一個jupyter notebook。

python3.6 -m pip install jupyterlab

如果我運行筆記本

python3.6 -m notebook

瀏覽器打開正確的頁面,但出現錯誤

KernelRestarter: restarting kernel (4/5), new random ports
WARNING:root:kernel f2bf7ea6-6f33-49a6-ad7c-3a2c60c41b6d restarted
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance
    app.initialize(argv)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 582, in initialize
    self.init_kernel()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 452, in init_kernel
    user_ns=self.user_ns,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 91, in __init__
    appnope.nope()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appnope/_nope.py", line 90, in nope
    "Because Reasons"
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appnope/_nope.py", line 60, in beginActivityWithOptions
    NSProcessInfo = C('NSProcessInfo')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appnope/_nope.py", line 38, in C
    assert ret is not None, "Couldn't find Class %s" % classname
AssertionError: Couldn't find Class NSProcessInfo

這個問題在https://github.com/minrk/appnope/issues/12中討論。 以下是潛在的解決方案:

  1. 可以禁用應用程序小睡
# ~/.ipython/profile_default/ipython_kernel_config.py
c.Kernel._darwin_app_nap = False
  1. 可以使用 python 3.8+ 這個問題似乎只發生在 python 版本 <3.8中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM