使用以下 Python 代码:
>>> from wifi import Cell, Scheme
>>> Cell.all('wlan0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/wifi/scan.py", line 39, in all
stderr=subprocess.STDOUT)
File"/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 629, in check_output
**kwargs).stdout
File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 696, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1540, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/sbin/iwlist'
为什么我收到错误消息 FileNotFoundError: [Errno 2] No such file or directory: '/sbin/iwlist'?
最佳答案
您尝试使用的 Python 模块只能在 Linux 上运行——“iwlist”可执行文件是特定于 Linux 的。该模块与 macOS 不兼容——您需要找到一个支持 macOS 的 Python 模块,或者在 Linux 计算机上使用该模块。 (虚拟机将不工作,因为它无法访问您机器的无线硬件。)
关于python-3.5 - 为什么我会收到 FileNotFoundError : [Errno 2] No such file or directory: '/sbin/iwlist' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37986950/