在Pipenv Shell中将Atom Hydrogen连接到内核

时间:2018-05-03 19:03:30

标签: python kernel atom-editor pipenv hydrogen

以下是我正在做的事情的快速概述:

  1. 在桌面上创建 foo 文件夹
  2. 打开Atom
  3. foo 添加为项目文件夹
  4. 在终端中打开 foo (通过Atom platformio-ide-terminal)
  5. cd ~/Desktop/foo
  6. 使用pipenv install numpy
  7. 设置环境
  8. 启动环境pipenv shell
  9. foo 中创建一个名为 bar.py 的文件,其中包含print("hi")
  10. 在Atom中打开 bar.py ,然后 [shift + enter] 自动启动Hydrogen。获得有关连接到哪个内核的承诺......
  11. 问题:我想将内核连接到pipenv shell中运行。我如何实现这一目标?

1 个答案:

答案 0 :(得分:3)

This stackoverflow post有一个答案,尽管步骤有所不同。

  1. 在您的虚拟环境中安装ipykernel:
    pipenv install ipykernel
  2. 使用以下命令启动shell:
    pipenv shell
  3. 设置名称,以便Atom Hydrogen可以识别:
    python -m ipykernel install --user --name=name-that-atom-hydrogen-will-list
  4. 从pipenv shell中启动Atom,然后在运行代码(控制输入)时,Atom应该列出要使用的python内核(包括name-that-atom-hydrogen-will-list)