打包程序后运行测试版时遇到报错
(base) RacheldeMacBook-Pro:code_to_be_packed Rachel1900$ ./dist/pic2txt.app/Contents/MacOS/pic2txt
2020-11-23 10:32:00.222 pic2txt[14294:919233] A Python runtime not could be located. You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application’s Info.plist file.
分析原因
根据报错信息“You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application’s Info.plist file”,分析报错原因应该是:py2app 和目前运行的python环境不兼容。
目前./dist/pic2txt.app/Contents/MacOS/pic2txt
在(base)
虚拟环境中,而py2app 在system的python版本中运行,
解决方案:
尝试deactive 虚拟环境base,重新运行应用
(如果系统环境中没有py2app及应用中需要额外安装的包pytesseract等,需在重新运行应用前安装)
<