项目场景:

使用pyinstaller打包paddle程序
1、遇到打不到CV,需要将openCV重装版本opencv-python:4.5.1.48
2、将C:\Program Files\Python38\Lib\site-packages\paddle\fluid\proto和C:\Program Files\Python38\Lib\site-packages\paddle\libs拷贝到工程目录相对应的文件夹下.
3.出现subprocess错误,需将C:\Program Files\Python38\Lib\site-packages\paddle\dataset下的images.py的
‘’’
if six.PY3:
import subprocess
import sys
import os
interpreter = sys.executable
# Note(zhouwei): if use Python/C ‘PyRun_SimpleString’, ‘sys.executable’
# will be the C++ execubable on Windows
if sys.platform == ‘win32’ and ‘python.exe’ not in interpreter:
interpreter = sys.exec_prefix + os.sep + ‘python.exe’
import_cv2_proc = subprocess.Popen(
[interpreter, “-c”, “import cv2”],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = import_cv2_procmunicate()
retcode = import_cv2_proc.poll()
if retcode != 0:
cv2 = None
else:
import cv2
‘’’
内容注掉。
4、打包的时候,要包括文件引用相对路径,所有的.py文件放在相同的一个文件夹内,如果不知道引用了那里,可以用raise打印出来。
5.如果打包时,与multiprocess出现异常,查看https://blog.csdn/qq842977873/article/details/82505578。

更多推荐

pyinstaler打包paddle