简体   繁体   English

在 node.js 中使用 python 模块

[英]Using python modules in node.js

Is it possible to create a glue that makes it possible for python modules (more specifically, library bindings) to be used in node.js?是否可以创建一种胶水,使 python 模块(更具体地说,库绑定)可以在 node.js 中使用? Some of the data structures can be directly mapped to V8 objects - eg array, dict.一些数据结构可以直接映射到 V8 对象——例如数组、字典。

More importantly - would that be a more elegant way to create bindings than manually or through FFI.更重要的是 - 这是否是一种比手动或通过 FFI 创建绑定更优雅的方式。 In short, would it be worth it?简而言之,值得吗?

Try this node.js module, that is a bridge: Node-Python ,试试这个 node.js 模块,它是一座桥梁: Node-Python

NOTE: The Project is 7 years old and still stuck at v0.4.注意:该项目已有 7 年历史,但仍停留在 v0.4。 A lot of functionality like converting between Python and Node arrays is still missing.许多功能,例如在 Python 和 Node 数组之间转换,仍然缺失。 It may be safe to assume that it's no longer supported by its original author(s)假设它的原作者不再支持它可能是安全的

Edge.js does a fine job at this. Edge.js在这方面做得很好。 It allows you to write a Python script and then call the routines from Node.js, which can be used to easily create bindings with python modules.它允许您编写 Python 脚本,然后从 Node.js 调用例程,可用于轻松创建与 Python 模块的绑定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM