在 win10 中使用 qtConsole 嵌入 ipython 时无法渲染对象

Can not render objects while embedding ipython with qtConsole in win10

我用 Ipython 嵌入了 QTConsole。 当我尝试在 Linux/Ubuntu 中通过 IPython 渲染对象时一切正常,但在 Win10 中,它无法渲染。

尽管我可以在 win10 上以单独的 window 渲染任何其他对象。

这是我的代码片段:

def run_embedded(theQueue):
param=theQueue.get()
handler=param[0]
connection_file=param[1]
handler.create_ui(connection_file)

def embed(handler):
connection_file = os.path.join(
    tempfile.gettempdir(),
    'connection-{:d}.json'.format(os.getpid()))
try:
    param=(handler, connection_file)
    m=multiprocessing.Manager()
    queue=m.Queue()
    queue.put(param)

    p=Pool(processes=2)
    p.map_async(run_embedded,(queue,))

    IPython.embed_kernel(
        local_ns=sys._getframe(1).f_locals,
        connection_file=connection_file,
        # gui='qt4',
    )

finally:
    try:
        os.unlink(connection_file)
    except OSError as exc:
        if exc.errno != errno.ENOENT:
            raise

class numManager(BaseManager):
pass

numManager.register('Handler', Handler)

def main():
m = multiprocessing.Manager()
mymanager = numManager()
mymanager.start()
handler = mymanager.Handler()
embed(handler)

if __name__ == "__main__":
main()

最后,我通过使用内核管理器来处理我的进程解决了我的问题