如何使用Python 3在Windows上连接到WiFi网络? [英] How to connect to WiFi network on Windows using Python 3?

查看:179
本文介绍了如何使用Python 3在Windows上连接到WiFi网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Python 3编写脚本,但是今天可用的所有模块都可以在python 2上运行,这将使我能够搜索无线网络并连接到它们.是否有任何Python 3库?

I am trying to write a script in Python 3 but all modules available today work on python 2 which will enable me to search for wireless networks and to connect to them. Is there any Python 3 library for this?

我为python 2尝试过的代码

The code I tried for python 2

from wireless import Wireless
wireless = Wireless()
wireless.connect(ssid='ssid', password='password')

这给我一个错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Himanshu Poddar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\wireless\Wireless.py", line 23, in __init__
    self._driver_name = self._detectDriver()
  File "C:\Users\Himanshu Poddar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\wireless\Wireless.py", line 50, in _detectDriver
    compare = self.vercmp(ver, "0.9.9.0")
  File "C:\Users\Himanshu Poddar\AppData\Local\Programs\Python\Python36-32\lib\site-packages\wireless\Wireless.py", line 71, in vercmp
    return cmp(normalize(actual), normalize(test))
NameError: name 'cmp' is not defined

但是这不起作用,因为它基于python2.有没有办法使用Python 3连接到wifi?

But this is not working since it is based on python 2. Is there any way to connect to a wifi using Python 3

推荐答案

注释(大约 [PyPI]:无线0.3.2 ]):

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