import netifaces as ni
ip = ni.ifaddresses("eth0")[ni.AF_INET]['addr']
错误
ip = ni.ifaddresses("eth0")[ni.AF_INET]['addr'] ValueError: 您必须指定一个有效的接口名称。
ip = ni.ifaddresses("en0")[ni.AF_INET]['addr']
错误
ip = ni.ifaddresses("en0")[ni.AF_INET]['addr'] TypeError: list indices must be integers or slices, not str
有谁知道为什么mac会出现这样的错误?