pybluez在Mac OS上的安装错误 [英] pybluez installation errors on Mac OS

查看:114
本文介绍了pybluez在Mac OS上的安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用以下命令安装 pybluez .

I tried to install pybluez using following commands.

pip install pybluez

sudo easy_install pybluez

但是对于这两个命令,我最终都会出错.

But for both commands I end up in errors.

环境:

Mac OSX 10.9.1
Python 2.7

Pip日志:

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -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.9-intel-2.7/osx/_osxbt.o

clang: warning: argument unused during compilation: '-mno-fused-madd'

osx/_osxbt.c:676:5: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?

    IOBluetoothDeviceInquiryRef inquiry;

    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

    IOBluetoothDeviceRef

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/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

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/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

----------------------------------------
Cleaning up...
  Removing temporary dir /private/var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip_build_~...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip_build_~/pybluez/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip-j1ASQD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip_build_~/pybluez
Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py", line 279, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 1380, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py", line 699, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip_build_~/pybluez/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip-j1ASQD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/f0/ldyq8xbx0fvckg001kk64j7r0000gn/T/pip_build_~/pybluez


**easy_install Logs** 

Reading http://pypi.python.org/simple/pybluez/
Best match: PyBluez 0.20
Downloading https://pypi.python.org/packages/source/P/PyBluez/PyBluez-0.20.zip#md5=79fad332df63b67a5f9a8d25042fb2a8
Processing PyBluez-0.20.zip
Running PyBluez-0.20/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Y5Y9H1/PyBluez-0.20/egg-dist-tmp-kwjDlw

clang: warning: argument unused during compilation: '-mno-fused-madd'

**osx/_osxbt.c:676:5: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean
      'IOBluetoothDeviceRef'?**
    IOBluetoothDeviceInquiryRef inquiry;
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    IOBluetoothDeviceRef

**/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/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

**/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/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: Setup script exited with error: command 'cc' failed with exit status 1

任何人能够在小牛上安装 pybluez 吗?

Any one able to install pybluez on Mavericks ?

Mountain Lion 上,安装错误也相同.

On Mountain Lion also the same installation errors.

将IOBluetoothDeviceInquiryRef替换为IOBluetoothDeviceRef,并摆脱了错误. 并由于警告而能够在Mac上安装.

Replaced IOBluetoothDeviceInquiryRef with IOBluetoothDeviceRef and got rid of the errors. and able to install on Mac because of the warnings.

使用sudo python setup.py install

这是输出

正在运行安装 运行构建 运行build_py 运行build_ext 运行install_lib 运行install_egg_info 删除/Library/Python/2.7/site-packages/PyBluez-0.20-py2.7.egg-info 编写/Library/Python/2.7/site-packages/PyBluez-0.20-py2.7.egg-info

running install running build running build_py running build_ext running install_lib running install_egg_info Removing /Library/Python/2.7/site-packages/PyBluez-0.20-py2.7.egg-info Writing /Library/Python/2.7/site-packages/PyBluez-0.20-py2.7.egg-info

当我尝试导入蓝牙时,我遇到了异常

When I tried to import bluetooth I got an exception

这是输出

>>>导入蓝牙 追溯(最近一次通话): 文件",第1行,在 在第47行的文件"bluetooth/__ init__.py"中 从osx import * 在第3行中输入文件"bluetooth/osx.py" 引发NotImplementedError NotImplementedError

>>> import bluetooth Traceback (most recent call last): File "", line 1, in File "bluetooth/__init__.py", line 47, in from osx import * File "bluetooth/osx.py", line 3, in raise NotImplementedError NotImplementedError

提到该错误的链接

使用pybluez进行python蓝牙发现

在Mac上安装pybluez应该怎么做

What should be done to install pybluez on Mac

推荐答案

PyBluez仅适用于PC.尝试浅蓝色

PyBluez is only for PC. Try lightblue

下载并安装主发行版: https://github.com/postskolkovo/lightblue-0.4

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

cd ~/Downloads/lightblue-0.4-master
sudo python setup.py install

如果出现错误:

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

** INSTALL FAILED **

您必须打开setup.py并进行更改:

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

收件人:

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

通过此讨论

这篇关于pybluez在Mac OS上的安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆