从Spyder内部导入PyQ会导致内核死亡

时间:2019-02-10 07:41:19

标签: python kdb pyq

已将kdb + 64位安装到Windows 10计算机上。

在Anaconda / Spyder中运行时,导入PyQ时,我收到一条错误消息,指出内核已死亡。从命令行单独运行q没问题。

这两者

import pyq

from pyq import q

给出此错误以及内核重新启动。

Kernel died, restarting

版本信息:

Spyder 3.3.1

Python 3.6

kdb + / q 3.6(64位)

有什么办法解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

您不能将pyq导入到常规的python会话中,但是您应该能够将Spyder连接到pyq内核。首先,安装pyq-kernel:

pip install pyq-kernel
pyq -m pyq.kernel install

第二,在控制台上启动pyq内核会话并找到内核ID:

$ jupyter console --kernel=pyq_3

In [2]: %connect_info
{
  "shell_port": 60484,
  "iopub_port": 60485,
  "stdin_port": 60486,
  "control_port": 60487,
  "hb_port": 60488,
  "ip": "127.0.0.1",
  "key": "ca3c4bc5-a55c552fdb14da48fda44b9d",
  "transport": "tcp",
  "signature_scheme": "hmac-sha256",
  "kernel_name": ""
}

Paste the above JSON into a file, and connect with:
    $> jupyter <app> --existing <file>
or, if you are local, you can connect with just:
    $> jupyter <app> --existing kernel-25218.json
or even just:
    $> jupyter <app> --existing
if this is the most recent Jupyter kernel you have started.

内核ID是`kernel-###。json文件中的数字。

最后,转到Spyder的IPython控制台窗口中齿轮图标下的菜单,选择“连接到现有内核”,然后在“内核ID /连接文件”框中输入在第二步中找到的内核ID。

相关问题