Netmiko-Windows 10-SSH路由器-无法仅运行第一个命令

问题描述 投票:-1回答:1
>>> from netmiko import ConnectHandler

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\netmiko\__init__.py", line 7, in <module>

你好专家,

从netmiko import ConnectHandler命令发布后,我遇到了以上错误。

安装程序-Windows 10,Python 3.7,Netmiko已安装。 PC中没有其他名为netmiko.py的文件。

请提出解决方案。

ssh router cisco netmiko
1个回答
0
投票

为了使用Netmiko,您需要与安装netmiko处于相同的python环境中。

我看到您安装了Windows 10和Python 3.7,但是用于调用Netmiko的python是2.7。您可以从目录名称C:\Python27\lib\site-packages\netmiko\__init__.py的“ Python27”中分辨出来。

运行Python 3.7 Shell,然后重试命令。确保在环境中正确安装了Netmiko。

要验证是否已安装netmiko,请键入help("modules")以检索所有已安装软件包的列表。如果已正确安装Netmiko,则应该在此处看到它。

Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")

Please wait a moment while I gather a list of all available modules...

                      ---- output omitted ----

Cryptodome          bdb                 gc                  pyexpat
__future__          binascii            genericpath         pygments
_string             codecs              netaddr             tabnanny
_strptime           codeop              netapp              tarfile
_struct             collections         netmiko             telnetlib
_symtable           colorama            netmiko_globals     tempfile
_testbuffer         colorsys            netrc               terminal_server
_testcapi           compileall          nntplib             test
_testconsole        concurrent          nt                  textfsm
_testimportmultiple configparser        ntpath              textwrap
_testmultiphase     contextlib          nturl2path          this
_textfsm            contextvars         numbers             threading

我希望这会有所帮助

© www.soinside.com 2019 - 2024. All rights reserved.