我使用 pyinstaller 创建了我的 python 代码的 .exe 并且它工作正常。但是在导入这个特定的包“from ciscoconfparse import CiscoConfParse”后,pyinstaller 能够创建 .exe 但是当我执行 .exe 时它会抛出错误消息
我尝试按照其他一些帖子中提到的方法进行解决,但似乎没有任何效果,只有在我使用 ciscoconfparse 模块时才会出现此问题。
请帮助我如何解决这个问题,使用这个模块很重要。
关注此链接https://pythonhosted.org/PyInstaller/spec-files.html#adding-files-to-the-bundle @AKX
我创建了一个规范文件并在规范文件中添加了这两行
datas=[( 'C:\Python27\Lib\site-packages\ciscoconfparse\*', 'ciscoconfparse' ) ],
hiddenimports=['ciscoconfparse'],
然后使用规范文件将其编译为 .exe
pyinstaller --clean -y --onefile "RR 配置 Scrub_v1.spec"
问题解决了
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句