问题
I'm trying to install the bluetooth module from lightblue.
My system: Mac OS X Snow Leopard 10.6.8, Python 2.7, gcc 4.2 & 4.0, xcode v.3.2.3 . I checked , i also got python 2.3/2.5/2.6 folders directly under /Library/Python/ in my system (This is different from 2.7 which is located in /Library/Frameworks/Python.framework/Versions/2.7/)
When I install lightblue with python setup.py install
, I get the following error:
GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file BBBluetoothOBEXClient.m)
** BUILD FAILED **
So I thought it was about the gcc version. So I did: 'export CC=gcc-4.0' or 'export CC=/usr/bin/gcc-4.0' (I got 2 versions of gcc on my Mac; 4.2 and 4.0). Then I checked with gcc -v
, it's already switched from 4.2 to 4.0. But when I rerun python setup.py install
, it is still showing 4.2:
GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file BBBluetoothOBEXClient.m)
** BUILD FAILED **
Why is it still showing gcc 4.2?
Does anyone have any solution? I tried using pip but got the same result.
回答1:
I accidentally found the solution, I grabbed this from : lightblue
For Mac OS 10.6 users:
- Open src/mac/_lightblue.py and change signature="v@:@iB" to signature="v@:@iZ" (line 468)
- Download and unzip LightAquaBlue-python-MacOS10.6.zip, which contains a LightAquaBlue directory. Move this directory into your python site-packages library, e.g. /Library/Python/2.6/site-packages
- Download and unzip LightAquaBlue-framework-MacOS10.6.zip, which contains a (completely different) LightAquaBlue directory. Move this directory into src/mac to replace the existing src/mac/LightAquaBlue directory. This should fix the architecture/build problems that existed with the old LightAquaBlue xcode project.
- Run python setup.py install as per normal to install.
Now when running python setup.py install
,I got this : ** BUILD SUCCEEDED **
Using pip will fail, except we alter some of installation source folders as above.
I got 'build succeeded', but haven't tested the module yet, as I need to finish other installation steps. I'm installing nxt-python ( python interface to control/program my lego mindstorm NXT -> nxt-python).
来源:https://stackoverflow.com/questions/11284694/how-to-install-lightblue-bluetooth-module-on-snow-leopard