xcode 没有名为 objc 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4678186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:05:02  来源:igfitidea点击:

No module named objc

pythonxcodepyobjc

提问by user573949

I'm trying to use cocoa-python with Xcode but it always calls up the error:

我正在尝试将 cocoa-python 与 Xcode 一起使用,但它总是调用错误:

Traceback (most recent call last):
  File "main.py", line 10, in <module>
    import objc
ImportError: No module named objc

This seems to be because dispite all my attempts to install or find objc and the other modules used by that file, they are simply not on my computer that I can tell, so does anyone know where I can download the actual files (or could put up their own copies?) as in objc.py, Foundation.py, AppKit.py and PyObjCTools.py?

这似乎是因为尽管我尝试安装或查找 objc 以及该文件使用的其他模块,但我知道它们根本不在我的计算机上,所以有人知道我可以在哪里下载实际文件(或可以放置自己的副本?)如 objc.py、Foundation.py、AppKit.py 和 PyObjCTools.py?

回答by Anderson Rodrigues

In MacOSX put on console:

在 MacOSX 上放置控制台:

pip install -U pyobjc

pip install -U pyobjc

回答by Shadikka

http://pyobjc.sourceforge.net/is the homepage of the whole PyObjC project, so if for some reason it isn't installed along OS X, you can always download it from there.

http://pyobjc.sourceforge.net/是整个 PyObjC 项目的主页,所以如果由于某种原因它没有安装在 OS X 上,你总是可以从那里下载它。