netifaces
netifaces copied to clipboard
Issues when installing on Raspberry Pi
running install running bdist_egg running egg_info writing netifaces.egg-info/PKG-INFO writing top-level names to netifaces.egg-info/top_level.txt writing dependency_links to netifaces.egg-info/dependency_links.txt reading manifest file 'netifaces.egg-info/SOURCES.txt' writing manifest file 'netifaces.egg-info/SOURCES.txt' installing library code to build/bdist.linux-armv7l/egg running install_lib running build_ext checking for getifaddrs... found. (cached) checking for getnameinfo... found. (cached) checking for optional header files... netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h. (cached) checking whether struct sockaddr has a length field... no. (cached) checking which sockaddr_xxx structs are defined... at ax25 in in6 ipx un ash ec ll atmpvc atmsvc dn irda llc. (cached) building 'netifaces' extension arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNETIFACES_VERSION=0.8 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -I/usr/include/python2.7 -c netifaces.c -o build/temp.linux-armv7l-2.7/netifaces.o netifaces.c:1:20: fatal error: Python.h: No such file or directory #include <Python.h> ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
sudo apt-get install python-dev fixed it.
Same fix worked for me as well.
@savnik's solution works for both python 2.7 and python 3.
It shows python-dev has no installation candidate. What to do next?
@mtcleverest
Have you searched for your problem?
- https://www.google.nl/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=raspberry+apt-get+install+no+candidate&*
- https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=79017
Your apt-get might be missing the repository which contains python-dev
.
I am getting the following error while using iPython (Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)) in a terminal window on a mac running Sierra and implementing the following example:
For convenience, we also allow you to index the dictionary with the special value 'default', which returns a dictionary mapping address families to the default gateway in each case. Thus you can get the default IPv4 gateway with
gws = netifaces.gateways() gws['default'][netifaces.AF_INET] ('10.0.1.1', 'en0')
The results from this test - I tried replacing "[]" with "()" in different combinations but get errors as follows:
In [15]: gws=netifaces.gateways In [16]: gws['default'][netifaces.AF_INET]
TypeError Traceback (most recent call last)
TypeError: 'builtin_function_or_method' object is not subscriptable
In [17]: gws['default'][netifaces.AF_INET]
TypeError Traceback (most recent call last)
TypeError: 'builtin_function_or_method' object is not subscriptable
In [18]: gws('default')[netifaces.AF_INET]
TypeError Traceback (most recent call last)
TypeError: gateways() takes no arguments (1 given)
In [19]: gws'default'
TypeError Traceback (most recent call last)
TypeError: 'builtin_function_or_method' object is not subscriptable
In [20]: gws('default')(netifaces.AF_INET)
TypeError Traceback (most recent call last)
TypeError: gateways() takes no arguments (1 given)
Is there a solution to this issue?