从 python2 代码调用 python3 代码 [英] Call python3 code from python2 code

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

问题描述

我正在使用 wxPython 工具包设计一个 GUI,这意味着它是用 python2 编写的.但是,我想将 python3 用于实际的应用程序代码.我将如何从 GUI 调用我的 python3 代码?

I am designing a GUI using the wxPython toolkit, which means it's being written in python2. However, I want to use python3 for the actual application code. How would I go about calling my python3 code from the GUI?

推荐答案

  1. 谈论管道或套接字

  1. Talk over a pipe or socket

尽可能从 __future__ 启用 Python 3 功能,或使用像 six 这样的库来编写与两者兼容的代码.

Enable such python 3 features as you can from __future__ or use a library like six to write code which is compatible with both.

不要这样做.

最后,你确定你不能在 Python 3 中使用 wxPython 吗?在线文档中没有任何内容说您不能.

Finally, are you sure you can't use wxPython in Python 3? There's nothing in the online docs saying you can't.

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

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