【问题标题】:How to communicate between Python and other languages?Python 与其他语言如何通信?
【发布时间】:2020-08-15 22:47:38
【问题描述】:

我想用 Python 制作一个带有图形界面的小型应用程序,但我想用另一种语言(例如 C++ 或 Golang)进行计算,可以吗?

【问题讨论】:

    标签: python sockets user-interface pipe communication


    【解决方案1】:

    从您的 C++ 源代码构建一个 .dll 或 .so 文件,然后使用 Python's ctypes 从中导入函数。或者,使用 Python C API 创建扩展模块。不同之处在于,在第一种方法中,互操作代码将在 Python 中,而在第二种方法中,它将在您的本机代码中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 2012-02-21
      • 1970-01-01
      • 2013-04-23
      • 2011-12-15
      • 1970-01-01
      相关资源
      最近更新 更多