Cx-freeze:编译成 .exe 和 Pytesseract 的 Python 程序不适用于其他用户 pc

问题描述

所以我设法将我的程序编译成一个带有“cx-freeze”的 .exe 文件,除了使用 PyTesseract 的功能外,一切都运行得很好。 我知道这个错误是因为你需要像我在这里一样设置你的 PyTesseract 路径:

PyTesseract.PyTesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract'

我知道一个简单的修复方法是让用户下载并安装 PyTesseract OCR 但这不是一个有效的解决方案,当然有办法修复它。

Setup.py 我曾经使用 cx-freeze 编译成 .exe:



# Dependencies are automatically detected,but it might need fine tuning.
build_exe_options = {"packages": ["tkinter","sys","pynput","time","pyautogui","PIL","os","win32api","win32con","cv2","pyperclip","PyTesseract","numpy","threading","MysqL.connector"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = "win32gui"  # <- no command line will appear

target = Executable(
script="MatrixARKBot.py",base=base,targetName="MatrixARKBot.exe") 

setup(  name = "MatrixARKBot.py",version = "0.1",description = "Matrix ARK Bot",options = {"build_exe": build_exe_options},executables = [target])
    ``` 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)