ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

在Anaconda Python中缺少socket.AF_BLUETOOTH吗?

2019-11-20 15:58:01  阅读:656  来源: 互联网

标签:python-3-x sockets anaconda bluetooth-lowenergy python


我正在尝试使用socket.AF_BLUETOOTH,如此处所述:https://docs.python.org/3.3/library/socket.html

我在Mac OS X 10.10.2上安装了Python 3.3.5 :: Anaconda 2.1.0(x86_64)

并且套接字模块似乎不包含任何AF_BLUETOOTH引用:

In [1]: import socket
In [2]: socket.AF
socket.AF_APPLETALK  socket.AF_INET       socket.AF_IPX        socket.AF_SNA        socket.AF_UNIX       
socket.AF_DECnet     socket.AF_INET6      socket.AF_ROUTE      socket.AF_SYSTEM     socket.AF_UNSPEC     

有人可以帮忙吗?

解决方法:

文档说:

Depending on the system and the build options, various socket families are supported by this module.

从Modules / socketmodule.c中的这一位开始:

#if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) && !defined(__NetBSD__) && !defined(__DragonFly__)
#define USE_BLUETOOTH 1

您需要确保在编译过程中将HAVE_BLUETOOTH_H或USE_BLUETOOTH设置为true.哪个取决于头文件的位置.它们可以位于/usr/include或/usr/include / bluetooth中.您可以通过以下方式检查当前设置:

import sysconfig
print sysconfig.get_config_vars()['HAVE_BLUETOOTH_H']

我猜当前返回0.来自pyconfig.h.in的提示:

/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */
#undef HAVE_BLUETOOTH_BLUETOOTH_H

因此,应确保在系统上存在bluetooth / bluetooth.h头文件,并且在编译过程中该头文件在搜索路径中可用.

标签:python-3-x,sockets,anaconda,bluetooth-lowenergy,python
来源: https://codeday.me/bug/20191120/2045181.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有