Python 尝试在macOS上安装PyBlue时出错

Python 尝试在macOS上安装PyBlue时出错,python,macos,pip,Python,Macos,Pip,我已经完成了sudoeasy\u安装pip 现在,我正在尝试使用sudopip install pyblue安装库pyblue 这就是我的错误: Password: Collecting pybluez Downloading PyBluez-0.22.zip (109kB) 100% |████████████████████████████████| 112kB 716kB/s Installing collected packages: pybluez Running setup

我已经完成了
sudoeasy\u安装pip

现在,我正在尝试使用
sudopip install pyblue安装库
pyblue

这就是我的错误:

Password:
Collecting pybluez
  Downloading PyBluez-0.22.zip (109kB)
100% |████████████████████████████████| 112kB 716kB/s 
Installing collected packages: pybluez
  Running setup.py install for pybluez ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ZBL104/pybluez/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-TidHjG-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/__init__.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/ble.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/bluez.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/btcommon.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/msbt.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/osx.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/widcomm.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
running build_ext
building 'bluetooth._osxbt' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/osx
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/IOBluetooth.framework/Headers -I/System/Library/Frameworks/CoreFoundation.framework/Headers -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c osx/_osxbt.c -o build/temp.macosx-10.12-intel-2.7/osx/_osxbt.o
osx/_osxbt.c:676:5: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?
    IOBluetoothDeviceInquiryRef inquiry;
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    IOBluetoothDeviceRef
/System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetoothUserLib.h:34:47: note: 'IOBluetoothDeviceRef' declared here
typedef struct OpaqueIOBluetoothObjectRef *                     IOBluetoothDeviceRef;
                                                                ^
osx/_osxbt.c:688:17: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?
                IOBluetoothDeviceInquiryRef inquiryRef,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                IOBluetoothDeviceRef
/System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetoothUserLib.h:34:47: note: 'IOBluetoothDeviceRef' declared here
typedef struct OpaqueIOBluetoothObjectRef *                     IOBluetoothDeviceRef;
                                                                ^
osx/_osxbt.c:703:19: warning: implicit declaration of function 'IOBluetoothDeviceInquiryCreateWithCallbackRefCon' is invalid in C99 [-Wimplicit-function-declaration]
    dd->inquiry = IOBluetoothDeviceInquiryCreateWithCallbackRefCon (&dd);
                  ^
osx/_osxbt.c:703:17: warning: incompatible integer to pointer conversion assigning to 'IOBluetoothDeviceRef' (aka 'struct OpaqueIOBluetoothObjectRef *') from 'int' [-Wint-conversion]
    dd->inquiry = IOBluetoothDeviceInquiryCreateWithCallbackRefCon (&dd);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
osx/_osxbt.c:705:5: warning: implicit declaration of function 'IOBluetoothDeviceInquirySetCompleteCallback' is invalid in C99 [-Wimplicit-function-declaration]
    IOBluetoothDeviceInquirySetCompleteCallback (dd->inquiry,
    ^
osx/_osxbt.c:717:5: warning: implicit declaration of function 'IOBluetoothDeviceInquiryStart' is invalid in C99 [-Wimplicit-function-declaration]
    IOBluetoothDeviceInquiryStart (dd->inquiry);
    ^
osx/_osxbt.c:721:5: warning: implicit declaration of function 'IOBluetoothDeviceInquiryDelete' is invalid in C99 [-Wimplicit-function-declaration]
    IOBluetoothDeviceInquiryDelete (dd->inquiry);
    ^
5 warnings and 2 errors generated.
error: command 'cc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ZBL104/pybluez/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-TidHjG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-ZBL104/pybluez/
不太清楚发生了什么以及如何修复

使用easy_install似乎也会出现类似的错误

问题:

  • 我应该手动安装pyblue吗
谢谢

苹果操作系统不支持您尝试使用的Pybluez软件包(2015年8月28日发布)

从:

蓝牙Python扩展模块,允许Python“”开发人员使用 系统蓝牙资源。PyBluez与GNU/Linux和 Windows XP

在编写pybluez时,它还没有在macOS(OSX 10.12)上进行测试,但是如果您确实想手动编译它,您需要。

根据:

Mac OS X(不稳定-仅在OS X 10.10/10.11上测试):

Python 2.3或更高版本

Xcode

PyObjc 3.1b或更高版本()

也许,这又能帮上一点忙


你可以看一看,这是跨平台的,但非常过时。

但是github页面说它不是真的。它说这是不稳定的!!@MauroBaraldi请注意,OP使用的pip包是在2015年8月28日发布的。在这一点上自述文件看起来像这样:-,没有列出OSX支持。关于OSX支持的一点s于2015年9月10日添加。还请注意,macOS是10.12,而不是自述文件中列出的10.10/10.11。