-->

PyObjC + Python 3.0 Questions

2020-07-05 07:53发布

问题:

By default, a Cocoa-Python application uses the default Python runtime which is version 2.5. How can I configure my Xcode project so that it would use the newer Python 3.0 runtime? I tried replacing the Python.framework included in the project with the newer version but it did not work.

And another thing, are PyObjc modules compatible with the new version of Python?

回答1:

PyObjC does not yet work with Python 3.0. According to Ronald Oussoren, a (the?) PyObjC developer, Python 3.0 support is possible, but not yet implemented:

Support for Python 3.x is on my todo list but is non-trivial to achieve. PyObjC contains a large amount of pretty low-level C code, getting the details w.r.t. to the changes in 3.0 right is not easy. I have looked into a Python 3.x port and this should be fairly easy, but it's still a couple of days work. I'm not planning to work on that before the next release of PyObjC, that's way too long overdue as it is.

I'm sure patches would be welcomed.



回答2:

PyObjC 2.3 added initial support for Python 3.1:

This version requires Python 2.6 or later, and also supports Python 3.1 or later.

but also

NOTE: Python 3 support is pre-alpha at this time: the code compiles but does not pass tests yet. The code also needs to be reviewed to check for python3<->objc integration (dict.keys now returns a view, NSDictionary.keys still returns a basic iterator, ...)

http://svn.red-bean.com/pyobjc/tags/pyobjc-2.3/pyobjc-core/NEWS.txt