【发布时间】:2020-11-08 03:43:27
【问题描述】:
我正在尝试使用 pyinstaller 为深度学习 python 应用程序创建可执行文件。
该应用程序在虚拟环境中运行并使用 tensorflow 和 opencv,我遇到了一些问题,但我已经解决了,但现在我被卡住了。似乎无法读取程序使用的 deploy.prototxt 文件
错误是:
cv2.error: OpenCV(4.3.0) C:\projects\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs 。开了()。无法在函数 'cv::dnn::ReadProtoFromTextFile' 中打开“face_detector\deploy.prototxt”
我将该文件路径包含在规范文件中,但没有成功。 我的规范文件是:
block_cipher = None
a = Analysis(['detect_mask_video.py'],
pathex=['C:\\Users\\Alexandru\\Envs\\deeplearning_covmask\\Lib\\site-packages', 'E:\\deeplearning\\apps\\face-mask-detector\\face-mask-detector'],
binaries=[],
datas=[('C:\\Users\\Alexandru\\Envs\\deeplearning_covmask\\Lib\\site-packages\\astor\\VERSION', 'astor\\VERSION' ),
('E:\\deeplearning\\apps\\face-mask-detector\\face-mask-detector\\face_detector\\deploy.prototxt','face_detector\\deploy.prototxt' )],
hiddenimports=['tensorflow'],
hookspath=['hooks'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='detect_mask_video',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
如何在生成的 exe 中包含 proto 文件?
【问题讨论】:
-
我的回答有帮助吗?
标签: python tensorflow opencv pyinstaller caffe