[英]Can not render objects while embedding ipython with qtConsole in win10
I've embedded QTConsole
with Ipython
.我内置
QTConsole
与Ipython
。 Everything works fine when I try to render objects through IPython
in Linux/Ubuntu but in Win10, it can not be rendered.当我尝试在 Linux/Ubuntu 中通过
IPython
渲染对象时一切正常,但在 Win10 中无法渲染。
although I can render any other objects in a separated window on win10.虽然我可以在 win10 上的单独窗口中渲染任何其他对象。
Here's my code snippet :这是我的代码片段:
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()
最后,我通过使用内核管理器来处理我的进程解决了我的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.