从Perl调用Python模块 [英] Calling a Python module from Perl

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

问题描述

我用Python创建了一个模块,该模块提供了大约十二种功能.虽然大多数将在Python内部使用它,但是有相当一部分旧用户会从Perl调用它.

I created a module in Python which provides about a dozen functionalities. While it will be mostly used from within Python, there is a good fraction of legacy users which will be calling it from Perl.

插入此模块的最佳方法是什么?我的想法是:

What is the best way to make a plug in to this module? My thoughts are:

  1. 提供作为命令行实用程序的功能并进行system调用
  2. 创建某种服务器并处理RPC调用(例如,通过JSON RPC)

有什么建议吗?

推荐答案

另一种选择是使用

One other choice is to inline Python directly in your Perl script, using Inline::Python.

这可能比其他解决方案更简单,并且仅需要一个附加模块.

This may be simpler than other solutions, and only requires one additional module.

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

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