ImportError: No module named pyobjc
Asked Answered
L

2

0

I am new to Python. I am running Mac OS X 10.8.2, Python 2.7.3, Xcode 4.5.1. I am not able to import pyobjc to python.I used easy_install pyobjc or manually downloading it from http://pypi.python.org/pypi/pyobjc/2.3 and running python setup.py install. Here is a screenshot of my site-packages folder enter image description here

How do I solve this?

Here is a screenshot of sys.path.PyOBJc is present in sys.path

Ludicrous answered 12/10, 2012 at 18:1 Comment(2)
Are you literally using import pyobjc? Looking at the samples, on the sourceforge site, it appears that you're supposed to call import objc or import py2app, or from PyObjCTools import AppHelper, etc. Take a look at the samples.Nailbrush
import objc all say module not presentLudicrous
M
2

I don't see a .pth file for pyobjc in your site-packages directory there.

.pth files, placed inside a directory already on Python's search path, contain directories to add to that search path. They're simple text files; you can review the ones already there to get a feel for how they work.

As to why you didn't get .pth files for pyobjc, I'm not sure. But you could create some to fix the problem up.

Further reading: Modifying Python’s Search Path

Misspeak answered 12/10, 2012 at 18:10 Comment(1)
I tried seeing the system path. It shows PyOBJC. But still it don't workLudicrous
P
1

The module name for PyObjC is not "pyobjc".

To use the low-level bridge use "import objc"

To access the Cocoa framework use "import Cocoa".

If "import objc" gives an import error you probably have a number of Python interpreters, check if the value of "sys.prefix" is what you expect it to be. Also check if "/Library/Frameworks/Python.framework/Version/2.7/lib/python2.7/site-packages" is on "sys.path".

Pacifa answered 20/11, 2012 at 13:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.