问题
I have successfully used Pyinstaller for a while and never faced issue with a library which was installed using pip. However recently i created a program using NAPALM library which is running perfectly fine from the IDE but when exported using Pyinstaller it is giving an error.
ERROR: Cannot import "ios". Is the library installed?
Python version: Python 3.7.1rc2
PIP package list:
C:\Users\yasir.zamir>pip list
Package Version
--------------- ----------
napalm 2.5.0
PyInstaller 3.5
cffi 1.13.2
PyYAML 5.2
paramiko 2.6.0
textfsm 1.1.0
Jinja2 2.10.3
netaddr 0.7.19
pyeapi 0.8.2
netmiko 2.4.2
junos-eznc 2.2.1
ciscoconfparse 1.4.11
scp 0.13.2
lxml 4.4.2
setuptools 39.0.1
Sample Code:
def main():
print("hello")
driver = get_network_driver('ios')
device = driver('192.168.1.1', 'admin', 'admin')
device.open()
device_fact=device.get_facts()
print(device_fact['vendor'])
print(device_fact['os_version'])
print(device_fact['serial_number'])
print(device_fact['model'])
print(device_fact['hostname'])
output_list = device_fact['os_version'].split(",")
ios_image = output_list[0].strip()
ios_version = output_list[1].strip()
print(ios_image)
print(ios_version)
Lastly, i have tried uninstalling and reinstalling both libraries using pip, tried in different sequence but to no avail.
来源:https://stackoverflow.com/questions/59450304/napalm-library-not-been-imported-when-using-pyinstaller