PyInstaller:IOError:[Errno 2]没有这样的文件或目录:使用ciscoconfparse库

时间:2018-06-04 12:59:52

标签: python-2.7 pyinstaller ciscoconfparse

我使用pyinstaller创建了我的python代码的.exe,它工作正常。但是在导入这个特定的包之后“从ciscoconfparse导入CiscoConfParse “,pyinstaller能够创建.exe但是当我执行.exe时会抛出错误消息

Please see this image link

我尝试在其他一些帖子中提到的解决方法,但似乎没有工作,只有当我使用ciscoconfparse模块时才能看到这个问题。

请帮助我如何解决这个问题,使用这个模块很重要。

1 个答案:

答案 0 :(得分:0)

通过@AKX

归档此链接https://pythonhosted.org/PyInstaller/spec-files.html#adding-files-to-the-bundle

我创建了一个spec文件,并在spec文件中添加了这两行

         datas=[(  'C:\Python27\Lib\site-packages\ciscoconfparse\*', 'ciscoconfparse' ) ],
         hiddenimports=['ciscoconfparse'],

然后使用spec文件

将其编译为.exe

pyinstaller --clean -y --onefile" RR Config Scrub_v1.spec"

问题已解决