Compiling modules in OSX, eg PyUSB?

Dr Mephesto dnhkng at
Fri Mar 20 14:48:00 CET 2009


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

But when I compile I get lots of errors, ie:

pcfr147:pyusb-0.4.1 david$ python install
running install
running build
running build_ext
building 'usb' extension
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -
fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/
Python.framework/Versions/4.1.30101/include/python2.5 -c pyusb.c -o
In file included from pyusb.c:11:
pyusb.h:6:17: error: usb.h: No such file or directory
In file included from pyusb.c:11:
pyusb.h:120: error: syntax error before 'usb_dev_handle'
pyusb.h:120: warning: no semicolon at end of struct or union
pyusb.h:122: error: syntax error before '}' token
pyusb.h:122: warning: data definition has no type or storage class
pyusb.h:131: warning: 'struct usb_endpoint_descriptor' declared inside
parameter list
pyusb.h:131: warning: its scope is only this definition or
declaration, which is probably not what you want
pyusb.c:2083: error: dereferencing pointer to incomplete type
pyusb.c:2084: warning: passing argument 1 of 'new_Bus' from
incompatible pointer type
lipo: can't figure out the architecture type of: /var/folders/xt/
error: command 'gcc' failed with exit status 1

A long time googling found this similar problem:
The suggested answer was to first do:

sudo apt-get install python-dev

But that was for a debian machine. I dont use fink, and I prefer to
use a standard osx python install if possible.   I am still a python
novice, and I'm not sure if I am using the "python install"
command wrongly, or if I need this python-dev package, or something
completely different.

Has anyone had this problem, or know a solution? Thanks in Advance!

More information about the Python-list mailing list