简体   繁体   中英

How to install jupyter notebook on mac?

I want to run a jupyter notebook on my mac where I have installed jupyter3.6 and jupyterlab .

python3.6 -m pip install jupyterlab

If I run the notebook

python3.6 -m notebook

The broswer open the right page but I get an error

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

This problem is discussed in https://github.com/minrk/appnope/issues/12 . Here are the potential solutions:

  1. one can disable app nap .
# ~/.ipython/profile_default/ipython_kernel_config.py
c.Kernel._darwin_app_nap = False
  1. One can use python 3.8+ . This issue only seems to happen in python version <3.8 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM