从 Ruby 调用 Python [英] Calling Python from Ruby

查看:53
本文介绍了从 Ruby 调用 Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个编译好的 Python 库和 API 文档,我想从 Ruby 中使用它们.

I have a compiled Python library and API docs that I would like to use from Ruby.

是否可以加载 Python 库、实例化其中定义的类并从 Ruby 调用该对象上的方法?

Is it possible to load a Python library, instantiate a class defined in it and call methods on that object from Ruby?

推荐答案

这篇文章给出了一些从 Python 运行 Ruby 代码的技术也应该适用于反向(例如 XML-RPC 或管道),以及从 Ruby 运行 Python 代码的特定技术.特别是 rubypythonRuby/Python 看起来他们可以做你想做的事.

This article gives some techniques for running Ruby code from Python which should also be applicable in the reverse direction (such as XML-RPC or pipes) as well as specific techniques for running Python code from Ruby. In particular rubypython or Ruby/Python look like they may do what you want.

这篇关于从 Ruby 调用 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆