本文整理匯總了Python中IPython.zmq.ipkernel.IPKernelApp.start方法的典型用法代碼示例。如果您正苦於以下問題:Python IPKernelApp.start方法的具體用法?Python IPKernelApp.start怎麽用?Python IPKernelApp.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPython.zmq.ipkernel.IPKernelApp
的用法示例。
在下文中一共展示了IPKernelApp.start方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: InternalIPKernel
# 需要導入模塊: from IPython.zmq.ipkernel import IPKernelApp [as 別名]
# 或者: from IPython.zmq.ipkernel.IPKernelApp import start [as 別名]
class InternalIPKernel(object):
"""Class for managing an IPython kernel inside of QGIS.
IPython normally runs kernels in seperate processes, but this setup is
limiting in the case of QGIS because external kernels cannot access the
data and variables that QGIS is working with. This class manages an
in-process kernel and is capable of launching external consoles that can
attach to the kernel.
IPython Consoles are run as external processes because they rely on
Version 2 of the PyQt api and QGIS is using Version 1 which is
incompatible.
"""
def __init__(self):
self.ipkernel = IPKernelApp()
self.ipkernel.initialize(['python',
# Ensure the Kernel pre-loads the same modules as are available
# from the QGIS python console.
"--c='from qgis.core import *;import qgis.utils;'"])
# Ensure we use an event loop that is QGIS-friendly.
self.ipkernel.kernel.eventloop = loop_qgis
self.ipkernel.start()
# To create and track active qt consoles
self._qtconsole_cmd = ['ipython', 'qtconsole', '--existing'] + \
[os.path.basename(self.ipkernel.connection_file)]
self.consoles = []
def new_qt_console(self, evt=None):
self.consoles.append(subprocess.Popen(self._qtconsole_cmd))
def cleanup_consoles(self, evt=None):
for c in self.consoles:
c.kill()
示例2: locals
# 需要導入模塊: from IPython.zmq.ipkernel import IPKernelApp [as 別名]
# 或者: from IPython.zmq.ipkernel.IPKernelApp import start [as 別名]
pass
locals().pop('__file__')
__doc__ = ''
__name__ = '__main__'
if os.environ.get('IPYTHON_KERNEL', False):
# IPython >=v0.11 Kernel
from IPython.zmq.ipkernel import IPKernelApp
__ipythonkernel__ = IPKernelApp().instance()
__ipythonkernel__.initialize(sys.argv[1:])
__ipythonshell__ = __ipythonkernel__.shell
__ipythonkernel__.start()
elif os.environ.get('IPYTHON', False):
sys.path.insert(0, '')
if os.name == 'nt':
# Windows platforms: monkey-patching *pyreadline* module
# to make IPython work in a remote process
from pyreadline import unicode_helper
unicode_helper.pyreadline_codepage = "ascii"
# For pyreadline >= v1.7:
from pyreadline import rlmain
class Readline(rlmain.Readline):
def __init__(self):
super(Readline, self).__init__()
self.console = None