在终端 MacOS 中找不到 jupyter 命令 建议:

问题描述

出于某种原因,当我 pip3 一切都在这个 PATH /Users/XXX/Library/Python/3.8/bin 我的笔记本也一样。

所以我打开了我的 vscode 并转到 .zshrc 并将 export PATH=$PATH:/Users/XXX/Library/Python/3.8/bin 添加到我的路径中。

然后我去终端 jupyter notebook 我得到了 zsh: /Users/XXX/Library/Python/3.8/bin/jupyter: bad interpreter: /usr/local/bin/python3: no such file or directory

然后我返回到 .zshrc 并将路径更改为 export PATH=$PATH:/Users/XXX/Library/Python/3.8/bin/jupyter-notebook 并添加到路径中,它得到了 zsh: command not found: jupyter

我拒绝使用 conda.. 没有特别的原因。

接下来我该怎么办?

更新

我想解决上述问题的实际原因是我的 jupyter 内核在我的 VS 代码中运行良好,但无法转换为 HTML。这就是为什么我认为安装基于 Web 的 Jupyter Notebook 可以帮助我解决这个问题。显然,它没有。当我尝试在基于网络的笔记本中转换为 HTML 时,它给了我 500 Internal Error

我也试过这样的python3 -m jupyter nbconvert --to html notebook.ipynb 我收到以下错误:

Traceback (most recent call last):
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/traitlets/traitlets.py",line 528,in get
    value = obj._trait_values[self.name]
KeyError: 'template_paths'

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "/Users/zhengyangzhang/Library/Python/3.8/bin/jupyter-nbconvert",line 8,in <module>
    sys.exit(main())
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/jupyter_core/application.py",line 270,in launch_instance
    return super(JupyterApp,cls).launch_instance(argv=argv,**kwargs)
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/traitlets/config/application.py",line 664,in launch_instance
    app.start()
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/nbconvertapp.py",line 350,in start
    self.convert_notebooks()
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/nbconvertapp.py",line 518,in convert_notebooks
    cls = get_exporter(self.export_format)
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/base.py",line 102,in get_exporter
    if getattr(exporter(config=config),'enabled',True):
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/templateexporter.py",line 325,in __init__
    super().__init__(config=config,**kw)
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/exporter.py",line 114,in __init__
    self._init_preprocessors()
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/templateexporter.py",line 491,in _init_preprocessors
    conf = self._get_conf()
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/templateexporter.py",line 507,in _get_conf
    for path in map(Path,self.template_paths):
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/traitlets/traitlets.py",line 556,in __get__
    return self.get(obj,cls)
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/traitlets/traitlets.py",line 535,in get
    value = self._validate(obj,dynamic_default())
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/templateexporter.py",in _template_paths
    template_names = self.get_template_names()
  File "/Users/zhengyangzhang/Library/Python/3.8/lib/python/site-packages/nbconvert/exporters/templateexporter.py",line 601,in get_template_names
    raise ValueError('No template sub-directory with name %r found in the following paths:\n\t%s' % (base_template,paths))
ValueError: No template sub-directory with name 'lab' found in the following paths:
    /Users/zhengyangzhang/Library/Jupyter
    /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter

有人可以再看看这里有什么问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)