导入错误:没有名为AppKit的模块 [英] Import Error: No module named AppKit

查看:65
本文介绍了导入错误:没有名为AppKit的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Mac OS X Lion Python 2.7 .我是python的新手.谁能告诉我如何 import AppKit PyObjC Python .但是在尝试导入 Import Error:No module named AppKit 或' Import Error:No module named PyObjC .

I use Mac OS X Lion and Python 2.7. I am new to python. Can anyone tell me how to import AppKit and PyObjC to Python. But i get the errors when trying to import Import Error: No module named AppKit or 'Import Error: No module named PyObjC.

尝试 easy_install 也无济于事.

如何导入这两个模块?

推荐答案

如果尚未安装,请通过运行以下命令安装 pip :

If not already installed, install pip by running:

sudo easy_install pip

然后运行:

## install for all users
sudo pip install pyobjc

## install for current user only
pip install pyobjc --user

注意:一般建议是使用系统python避免避免,而应使用用户维护的版本,例如通过 brew install python3 安装code>, macports conda 或您已经用于第三方依赖项的任何内容.

NOTE: the general recommendation is to avoid using the system python, and use instead a user-maintained version, for example installed via brew install python3, macports, conda or whatever you already use for third party dependencies.

这篇关于导入错误:没有名为AppKit的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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