How to install either pybluez or LightBlue on OSX 10.9 (Mavericks‎)

前端 未结 2 845
离开以前
离开以前 2021-01-01 01:45

I have tried to install both of pybluez and LightBlue on OSX10.9 but I am getting error. Does anyone has managed to install any of these on Mavericks?

I am getting

相关标签:
2条回答
  • 2021-01-01 02:03

    PyBluez is windows only:

    "PyBluez works on GNU/Linux and Windows XP (Microsoft and Widcomm Bluetooth stacks)." - pybluez homepage

    It looks like you're installing the wrong version of LightBlue

    Check dependencies 
    error: There is no SDK with the name or path '/Users/myname/Downloads/lightblue-0.4/src/mac/LightAquaBlue/macosx10.6'
    

    it's looking for a file for OSX 10.6.

    Download and install the master distribution: https://github.com/postskolkovo/lightblue-0.4

    If you get the error:

    Check dependencies
    No architectures to compile for (ARCHS=$(NATIVE_ARCH_ACTUAL), VALID_ARCHS=i386 x86_64).
    
    ** INSTALL FAILED **
    

    you'll have to open up setup.py and change:

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

    to:

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

    via this discussion

    Edit
    I actually got a ImportError: Bundle could not be loaded on Mavericks when I tried to import.
    This seems to be the fix for 64 bit computers:

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

    Might be necessary if you come across the same thing.

    0 讨论(0)
  • 2021-01-01 02:17

    there is an other version which is especially for mac osx 10.8 https://github.com/0-1-0/lightblue-0.4. I can also run this version under osx 10.10 Yosemite.

    I just had to follow the change the following line in the setup.py file:

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

    and then i did insert the following two methods in /Library/Python/2.7/site-packages/lightblue/_lightblue.py :

    def deviceInquiryDeviceNameUpdated_device_devicesRemaining_(self, sender, device, devicesRemaining): pass

    def deviceInquiryUpdatingDeviceNamesStarted_devicesRemaining_(self, sender, devicesRemaining): pass

    after the constructer of:

    _AsyncDeviceInquiry(Foundation.NSObject):
    

    the complete code is then:

    class _AsyncDeviceInquiry(Foundation.NSObject): 
    
    # NSObject init, not python __init__
    def init(self):
        try:
            attr = _IOBluetooth.IOBluetoothDeviceInquiry
        except AttributeError:
            raise ImportError("Cannot find IOBluetoothDeviceInquiry class " +\
                "to perform device discovery. This class was introduced in " +\
                "Mac OS X 10.4, are you running an earlier version?")
    
        self = super(_AsyncDeviceInquiry, self).init()
        self._inquiry = \
            _IOBluetooth.IOBluetoothDeviceInquiry.inquiryWithDelegate_(self)
    
        # callbacks
        self.cb_started = None
        self.cb_completed = None
        self.cb_founddevice = None
    
        return self
    
    def deviceInquiryDeviceNameUpdated_device_devicesRemaining_(self, sender, device, devicesRemaining):
        pass
    
    def deviceInquiryUpdatingDeviceNamesStarted_devicesRemaining_(self, sender, devicesRemaining):
        pass
    

    the last step is to alter this line in the same file:

    deviceInquiryComplete_error_aborted_, signature="v@:@iB")
    

    to

    deviceInquiryComplete_error_aborted_, signature="v@:@iZ")
    

    for me that works fine!

    Hope that this is a helpful post.

    0 讨论(0)
提交回复
热议问题