简体   繁体   English

atom:已安装氢气,但代码未运行(在macOS上)

[英]atom: hydrogen installed, but the code is not running (on macOS)

I have the following setting: 我有以下设置:

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

running code works in Terminal as well as in atom with script but nothing happen when running the code with hydrogen: 运行代码在Terminal以及script中的原子中都可以使用,但是在用氢气运行代码时什么也没有发生:

氢输出

In the Language Mappings of Hydrogen it is written: HydrogenLanguage Mappings中写为:

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

when running jupyter kernelspec list I get: python3 /usr/local/etc/jupyter/kernels/python3 . 当运行jupyter kernelspec list我得到: python3 /usr/local/etc/jupyter/kernels/python3 In this directory there is a kernel.json file with the following content: 在此目录中,包含一个具有以下内容的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"
}

in the directory /usr/local/Cellar/python/3.7.2_2/bin there are the following items /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

Is the path in the kernel.json file the correct one? kernel.json文件中的路径正确吗?

I also looked at this github page but I couldn't solve the problem 我也看了一下这个github页面,但无法解决问题

What am I doing wrong? 我究竟做错了什么?

Your kernelspec argv argument is pointing to ../python.3x/bin instead of directly to the python3 executable. 您的kernelspec argv参数指向../python.3x/bin而不是直接指向python3可执行文件。 Pointing to the executable directly with ../python.3x/bin/python3 is more typical and might be the issue. 直接使用../python.3x/bin/python3指向可执行文件更为典型,这可能是问题所在。

How did you install your kernel? 您是如何安装内核的? I'd recommend taking a look at this kernel installation guide and probably reinstalling your kernel with, in your case, python3 -m ipykernel install . 我建议您看一下此内核安装指南,并根据情况使用python3 -m ipykernel install重新安装您的内核。 I think this will work, but, manually editing the kernel.json file would be another (not recommended) way to fix this. 我认为这会起作用,但是,手动编辑kernel.json文件将是另一种(不推荐)解决此问题的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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