Python蓝牙模块lightblue在mac osx 10.8上不起作用

时间:2012-12-21 01:36:18

标签: python macos bluetooth

我正在尝试安装python蓝牙模块'lightblue'。我使用macport来安装它。当我导入模块时,它会导致一堆错误。

>> import lightblue
2012-12-21 07:04:13.874 Python[4062:f07] PyObjCPointer created: at 0x7fff788af900 of type {__CFBoolean=}
2012-12-21 07:04:13.875 Python[4062:f07] PyObjCPointer created: at 0x7fff788af8f0 of type {__CFBoolean=}
2012-12-21 07:04:13.876 Python[4062:f07] PyObjCPointer created: at 0x7fff788af910 of type {__CFNumber=}
2012-12-21 07:04:13.876 Python[4062:f07] PyObjCPointer created: at 0x7fff788af928 of type {__CFNumber=}
2012-12-21 07:04:13.876 Python[4062:f07] PyObjCPointer created: at 0x7fff788af940 of type {__CFNumber=}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
    from _lightblue import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_lightblue.py", line 28, in <module>
    import _LightAquaBlue
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_LightAquaBlue.py", line 32, in <module>
    _FRAMEWORK_PATH)
ImportError: Cannot load LightAquaBlue framework, not found at/opt/local/Library/Frameworks/LightAquaBlue.framework

请帮我安装这个模块。我没有找到很多其他蓝牙编程模块.pybluez没有mac版本

2 个答案:

答案 0 :(得分:3)

This version在Mountain Lion成功为我工作。

答案 1 :(得分:1)

我不确定这是否直接适用于原始问题......

执行摘要:使用“sudo”并注意安装程序错误消息。

我尝试在运行Xcode 5.0.2的Mac上安装lightblue-0.4

根据我在不同地方发现的建议,我将setup.py的最后一行更改为:

    os.system("xcodebuild install -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES")

我将setup.py中的其他行更改为:

packages=["lightblue","LightAquaBlue"],
package_dir={"lightblue":getpackagedir(), "LightAquaBlue":"%s/LightAquaBlue" % getpackagedir()},
package_data={"lightblue":[ ], "LightAquaBlue":["LightAquaBlue.bridgesupport"]},

我不得不将LightAquaBlue Base SDK的Xcode中的Build Settings更改为OS X 10.9(它正在寻找10.4u - “u”=“up up”吗?当我得到它时我没有使用sudo Xcode中的错误消息)

运行安装时出现chown权限错误,直到我使用“sudo python setup.py install”

最后(叹气),我不得不复制LightAquaBlue别名 Macintosh HD / Libraries / LightAquaBlue.framework文件夹并将其粘贴到 Macintosh HD / Libraries / LightAquaBlue.framework / Versions / A文件夹

毕竟我得到了:

** INSTALL SUCCEEDED **

这将导致此文件夹中有大量目标文件:

lightblue-0.4 / SRC / MAC / LightAquaBlue /建造/ LightAquaBlue.build /释放/ LightAquaBlue.build /对象 - 正常/ x86_64的