1 安装
pip install jsonrpclib-pelix
2 服务端
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServerserver = SimpleJSONRPCServer(('localhost', 8081))server.register_function(lambda x,y: x+y, 'add')server.serve_forever()
3 客气端
import jsonrpclibserver = jsonrpclib.ServerProxy('http://localhost:8081')print(server.add(5,6))
