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.
Trying easy_install does not help either. 
What can i do to import these 2 modules?
106 Answers
If not already installed, install pip by running:
sudo easy_install pip Then run:
## install for all users sudo pip install pyobjc or
## install for current user only pip install pyobjc --user 2NOTE: 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,condaor whatever you already use for third party dependencies.
If you're on Mac it could be you're using the incorrect pip version, try sudo pip3 install -U pyobjc that solved it for me.
This a good guide on how to install PyObjc:
When I was trying to install PyObjc I found it quite hard, but after a while, (and lots of google searches) I got it working.
Edit
I've found a more modern guide on how to do this. Download the templates and put them into your ~/Library/Developer/Xcode/Templates/ directory, and everything should work correctly.
If you are using PyCharm, you should install PyObjC package manually within it because of venv I guess. This was the only working solution for me.
In my case none of them worked. I was using Anaconda in my mac, later I discovered that the main issue with the Anaconda. Then I installed PyObjC with it's all supporting libraries inside Anaconda in a specific Environment.
I run the command line by clicking the Environment play icon and run my script.
It worked without any issues :)
If you've tried:
sudo pip install pyobjc
And it still isn't working then you may have at some point in the past accidentally installed an incorrect AppKit. Run:
sudo pip uninstall appkit
And then try
sudo pip install pyobjc
again. The issue I faced was that the other appkit was lowercase so wasn't recognised (and was the wrong package) but it was preventing pyobjc from installing the correct version of AppKit.
