Compiling modules in OSX, eg PyUSB?

Philip Semanchuk philip at
Fri Mar 20 15:11:20 CET 2009

On Mar 20, 2009, at 9:48 AM, Dr Mephesto wrote:

> Hi,
> I am using Leopard and MacPython, and I would like to access a USB
> device. I have installed libusb, and now I have tried to compile PyUSB
> from:
> But when I compile I get lots of errors, ie:

Hi Dr. M.,
The first error you get is that the compiler can't find usb.h:

> pyusb.h:6:17: error: usb.h: No such file or directory

It's not surprising that a compile produces lots of errors when it  
can't find a header file.

This project is looking for a header file that's not on your system  
because PyUSB is Linux-specific. That doesn't mean it can't be made to  
run on OS X, but the amount of effort required to make that happen  
might range anywhere from trivial to difficult.

PyUSB deals with hardware, and I wouldn't be surprised to find that a  
hardware interface varies from OS to OS. Since an entire header file  
is missing here, my guess is that making it work on OS X would be  
closer to difficult than trivial. It's also possible (likely?) that  
the author doesn't even have a Mac or access to one, and so can't  
experiment under OS X.

You need to contact the package author to ask if he has considered OS  
X support. If not, you'll need to find another package. Google for  
something like this:
python usb "os x"

That should help you to find packages that will work under OS X. Be  
aware that there might not be such a package. :-/

Hope this helps

More information about the Python-list mailing list