我试图从http://codespeak.net/execnet/example/hybridpython.html运行一个示例,但python冻结在线:
gw = execnet.makegateway("popen//python=jython")
示例:
import execnet
gw = execnet.makegateway("popen//python=jython")
channel = gw.remote_exec("""
from java.util import Vector
v = Vector()
v.add('aaa')
v.add('bbb')
for val in v:
channel.send(val)
""")
for item in channel:
print (item)
我在Debian Jessie身上
答案 0 :(得分:0)
如果您阅读文档,则定义以下内容
def makegateway(self, spec=None):
"""create and configure a gateway to a Python interpreter.
The ``spec`` string encodes the target gateway type
and configuration information. The general format is::
key1=value1//key2=value2//...
If you leave out the ``=value`` part a True value is assumed.
Valid types: ``popen``, ``ssh=hostname``, ``socket=host:port``.
Valid configuration::
id=<string> specifies the gateway id
***python=<path> specifies which python interpreter to execute***
execmodel=model 'thread', 'eventlet', 'gevent' model for execution
chdir=<path> specifies to which directory to change
nice=<path> specifies process priority of new process
env:NAME=value specifies a remote environment variable setting.
If no spec is given, self.defaultspec is used.
"""
意思是你应该写:
gw = execnet.makegateway("popen//python=C:\\..\\jython2.7.0\\bin\\jython")