我的环境是python3.8 电脑是64位
PS D:\Python_Files\python2020item\netdev_demo> py Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
本来安装netdev只需要在cmd下pip install netdev即可,但是我执行出现下面错误
C:\Users\Administrator>pip install netdev WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/netdev/ Collecting netdev Using cached https://files.pythonhosted.org/packages/15/0a/4313e30381e6c9dfd7988de62b0b6b392af4bfe993afaef9c4c8c2507eda/netdev-0.9.3-py3-none-any.whl ERROR: Could not find a version that satisfies the requirement PyYAML<6.0,>=5.1 (from netdev) (from versions: none) ERROR: No matching distribution found for PyYAML<6.0,>=5.1 (from netdev) C:\Users\Administrator>
所以我干脆直接复制报错链接内的netdev下面的链接地址https://files.pythonhosted.org/packages/15/0a/4313e30381e6c9dfd7988de62b0b6b392af4bfe993afaef9c4c8c2507eda/netdev-0.9.3-py3-none-any.whl
把netdev-0.9.3-py3-none-any.whl下载下来,之后pip install netdev-0.9.3-py3-none-any.whl进行安装。
第一个错误:
PS D:\Python_Files\python2020item\netdev_demo\file> pip install .\netdev-0.9.3-py3-none-any.whl Processing d:\python_files\python2020item\netdev_demo\file\netdev-0.9.3-py3-none-any.whl ERROR: Could not find a version that satisfies the requirement asyncssh<2.0,>=1.15 (from netdev==0.9.3) (from versions: none) ERROR: No matching distribution found for asyncssh<2.0,>=1.15 (from netdev==0.9.3) PS D:\Python_Files\python2020item\netdev_demo\file>
ok,需要安装asyncssh 1.15,那我安装,pip install asyncssh发现是报错的,没资源,那么你在http://pypi.doubanio.com/simple/里面查找asyncssh 1.15版本进行安装!
PS D:\Python_Files\python2020item\netdev_demo\file> pip install .\asyncssh-1.15.0-py3-none-any.whl Processing d:\python_files\python2020item\netdev_demo\file\asyncssh-1.15.0-py3-none-any.whl Requirement already satisfied: cryptography>=1.5 in c:\python38\lib\site-packages (from asyncssh==1.15.0) (2.8) Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\python38\lib\site-packages (from cryptography>=1.5->asyncssh==1.15.0) (1.13.2) Requirement already satisfied: six>=1.4.1 in c:\python38\lib\site-packages (from cryptography>=1.5->asyncssh==1.15.0) (1.12.0) Requirement already satisfied: pycparser in c:\python38\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=1.5->asyncssh==1.15.0) (2.19) Installing collected packages: asyncssh Successfully installed asyncssh-1.15.0 PS D:\Python_Files\python2020item\netdev_demo\file>
第二个错误:
PS D:\Python_Files\python2020item\netdev_demo\file> pip install .\netdev-0.9.3-py3-none-any.whl Processing d:\python_files\python2020item\netdev_demo\file\netdev-0.9.3-py3-none-any.whl Requirement already satisfied: asyncssh<2.0,>=1.15 in c:\python38\lib\site-packages (from netdev==0.9.3) (1.15.0) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pyyaml/ ERROR: Could not find a version that satisfies the requirement PyYAML<6.0,>=5.1 (from netdev==0.9.3) (from versions: none) ERROR: No matching distribution found for PyYAML<6.0,>=5.1 (from netdev==0.9.3) PS D:\Python_Files\python2020item\netdev_demo\file>
ok,需要安装PyYAML 5.1,那我安装,pip install asyncssh发现是报错的,没资源,那么你在http://pypi.doubanio.com/simple/里面查找PyYAML 5.1版本进行安装!但是都报平台版本不对,我明明下载了python3.8 64位是正确的啊,怎么还是不行!32位也试了,还是不行!
PS D:\Python_Files\python2020item\netdev_demo\file> pip install .\PyYAML-5.1.2-cp38-cp38m-win_amd64.whl ERROR: PyYAML-5.1.2-cp38-cp38m-win_amd64.whl is not a supported wheel on this platform. PS D:\Python_Files\python2020item\netdev_demo\file> pip install .\PyYAML-5.1.2-cp38-cp38m-win32.whl ERROR: PyYAML-5.1.2-cp38-cp38m-win32.whl is not a supported wheel on this platform. PS D:\Python_Files\python2020item\netdev_demo\file>
最后解决办法是看了这一篇文章(https://blog.csdn.net/xdygzsxg/article/details/53885786?utm_source=blogxgwz8),很神奇,居然是修改PyYAML-5.1.2-cp38-cp38m-win_amd64.whl文件名,重命名为PyYAML-5.1.2-cp38-none-win_amd64.whl即可!
我试了下,果然好使:PyYAML-5.1.2安装完毕之后,netdev也成功安装了!
PS D:\Python_Files\python2020item\netdev_demo\file> pip install PyYAML-5.1.2-cp38-none-win_amd64.whl Processing d:\python_files\python2020item\netdev_demo\file\pyyaml-5.1.2-cp38-none-win_amd64.whl Installing collected packages: PyYAML Successfully installed PyYAML-5.1.2 PS D:\Python_Files\python2020item\netdev_demo\file> PS D:\Python_Files\python2020item\netdev_demo\file> PS D:\Python_Files\python2020item\netdev_demo\file> pip install .\netdev-0.9.3-py3-none-any.whl Processing d:\python_files\python2020item\netdev_demo\file\netdev-0.9.3-py3-none-any.whl Requirement already satisfied: PyYAML<6.0,>=5.1 in c:\python38\lib\site-packages (from netdev==0.9.3) (5.1.2) Requirement already satisfied: asyncssh<2.0,>=1.15 in c:\python38\lib\site-packages (from netdev==0.9.3) (1.15.0) Requirement already satisfied: cryptography>=1.5 in c:\python38\lib\site-packages (from asyncssh<2.0,>=1.15->netdev==0.9.3) (2.8) Requirement already satisfied: six>=1.4.1 in c:\python38\lib\site-packages (from cryptography>=1.5->asyncssh<2.0,>=1.15->netdev==0.9.3) (1.12.0) Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\python38\lib\site-packages (from cryptography>=1.5->asyncssh<2.0,>=1.15->netdev==0.9.3) (1.13.2) Requirement already satisfied: pycparser in c:\python38\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=1.5->asyncssh<2.0,>=1.15->netdev==0.9.3) (2.19) Installing collected packages: netdev Successfully installed netdev-0.9.3 PS D:\Python_Files\python2020item\netdev_demo\file> python Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import netdev >>> >>>