简体   繁体   English

Python蓝牙模块lightblue在Mac OS X 10.8上不起作用

[英]Python bluetooth module lightblue doesn't work on mac osx 10.8

I'm trying to install python bluetooth module 'lightblue'.I intalled it using macports.When I import the module it is resulting in a bunch of errors. 我正在尝试安装python蓝牙模块'lightblue'。我使用macports安装了它。导入模块时会导致很多错误。

>> 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

Please help me out to install this module.I didn't find many other bluetooth programming modules.pybluez doesn't have a mac version 请帮我安装此模块。我没有找到其他许多蓝牙编程模块。pybluez没有mac版本

此版本对我在Mountain Lion上成功运行。

I'm not sure if this applies directly to the original problem or not… 我不确定这是否直接适用于原始问题...

Executive summary: use "sudo" and pay attention to the installer error messages. 执行摘要:使用“ sudo”并注意安装程序错误消息。

I tried to install lightblue-0.4 on my Mac running Xcode 5.0.2 我试图在运行Xcode 5.0.2的Mac上安装lightblue-0.4

From suggestions I found in various places, I changed the last line of setup.py to this: 根据在不同地方找到的建议,我将setup.py的最后一行更改为:

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

I changed other lines in setup.py to these: 我将setup.py中的其他行更改为:

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

I had to change the Build Settings in Xcode for LightAquaBlue Base SDK to OS X 10.9 (it was looking for 10.4u -- does the "u" = "and up"? I wasn't using sudo when I got the error messages in Xcode) 我必须将LightAquaBlue Base SDK的Xcode中的Build Settings更改为OS X 10.9(它正在寻找10.4u-“ u” =“ and up”吗?当我收到错误消息时,我没有使用sudo。 Xcode)

I got chown permission errors running the install until I used "sudo python setup.py install" 在使用“ sudo python setup.py install”之前,我在运行安装时遇到了chown权限错误。

Finally (sigh), I had to copy the LightAquaBlue alias in the Macintosh HD/Libraries/LightAquaBlue.framework folder and paste it in the Macintosh HD/Libraries/LightAquaBlue.framework/Versions/A folder 最后,我不得不在Macintosh HD / Libraries / LightAquaBlue.framework文件夹中复制LightAquaBlue别名,并将其粘贴到Macintosh HD / Libraries / LightAquaBlue.framework / Versions / A文件夹中

After all that I got: 毕竟我得到了:

** INSTALL SUCCEEDED ** **安装成功**

This will result in a bunch of object files in this folder: 这将在此文件夹中生成一堆目标文件:

lightblue-0.4/src/mac/LightAquaBlue/build/LightAquaBlue.build/Release/LightAquaBlue.build/Objects-normal/x86_64 lightblue-0.4 / src / mac / LightAquaBlue / build / LightAquaBlue.build / Release / LightAquaBlue.build / Objects-normal / x86_64

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM