【问题标题】:atom: hydrogen installed, but the code is not running (on macOS)atom: 已安装氢,但代码未运行(在 macOS 上)
【发布时间】:2019-08-07 13:44:18
【问题描述】:

我有以下设置:

  • Python 3.7.2
  • macOS 10.14
  • Atome 1.35.1
  • Script 3.18.1
  • Hydrogen 2.8.0

运行代码在Terminal 和原子script 中运行,但在使用氢运行代码时没有任何反应:

HydrogenLanguage Mappings中写着:

{ "python": "magicpython", "python3": "magicpython" }

运行时jupyter kernelspec list 我得到:python3 /usr/local/etc/jupyter/kernels/python3。在这个目录中有一个kernel.json文件,内容如下:

{
 "argv": [
  "/usr/local/Cellar/python/3.7.2_2/bin",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
"env": {
  "PYTHONPATH": "/usr/local/Cellar/ipython/7.3.0/libexec/lib/python3.7/site-packages:/usr/local/Cellar/ipython/7.3.0/libexec/vendor/lib/python3.7/site-packages"
}
,
 "display_name": "Python 3",
 "language": "python"
}

/usr/local/Cellar/python/3.7.2_2/bin目录下有以下几项

2to3            pip3.7          python3.7-config
2to3-3.7        pydoc3          python3.7m
easy_install-3.7    pydoc3.7        python3.7m-config
idle3           python3         pyvenv
idle3.7         python3-config      pyvenv-3.7
pip3            python3.7       wheel3

kernel.json 文件中的路径是否正确?

我也看过这个github page,但我无法解决问题

我做错了什么?

【问题讨论】:

    标签: python macos kernel atom-editor hydrogen


    【解决方案1】:

    您的 kernelspec argv 参数指向 ../python.3x/bin 而不是直接指向 python3 可执行文件。使用../python.3x/bin/python3 直接指向可执行文件更为典型,可能是问题所在。

    您是如何安装内核的?我建议您查看this kernel installation guide 并可能使用python3 -m ipykernel install 重新安装您的内核。我认为这会起作用,但是手动编辑 kernel.json 文件将是解决此问题的另一种(不推荐)方法。

    【讨论】:

    • 非常感谢@BenRussert。所以我做了这两件事(运行python3 -m ipykernel 并更改了.json 文件中的路径)。我不知道什么有效,但它有效
    猜你喜欢
    • 1970-01-01
    • 2020-05-08
    • 2020-11-23
    • 1970-01-01
    • 2014-12-14
    • 1970-01-01
    • 2022-09-26
    • 2019-09-28
    • 2023-03-23
    相关资源
    最近更新 更多