没有名为 objc 的模块
我正在尝试将 cocoa-python 与 Xcode 一起使用,但它总是会出现错误:
Traceback (most recent call last):
File "main.py", line 10, in <module>
import objc
ImportError: No module named objc
这似乎是因为尽管我尝试安装或查找 objc 以及该文件使用的其他模块,但它们根本不在我的计算机上我可以告诉,所以有人知道我可以在哪里下载 objc.py、Foundation.py、AppKit.py 和 PyObjCTools.py 中的实际文件(或者可以放置他们自己的副本?)?
I'm trying to use cocoa-python with Xcode but it always calls up the error:
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 MacOSX 中,打开控制台:
pip install -U pyobjc
In MacOSX put on console:
pip install -U pyobjc
http://pyobjc.sourceforge.net/ 是整个 PyObjC 项目的主页,所以如果由于某种原因它没有随 OS X 一起安装,您可以随时从那里下载它。
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.
如果您安装了多个 Python 并且 pythonpath 配置错误,也可能会发生这种情况。有关一种可能的解决方法的详细信息:https://stackoverflow.com/a/73459838/11072418
This can also happen if you have multiple Python installations and a misconfigured pythonpath. For more info on one possible way to resolve: https://stackoverflow.com/a/73459838/11072418