Unable to launch Python executable that depends on a CTF from Library Compiler

조회 수: 7 (최근 30일)
I created an application in Python that uses MATLAB functions accessed through the Library Compiler for Python. My application works fine, and I am able to call the MATLAB functions in my Python code and I receive no errors.
I would like to compile this application into an EXE file by using
. However, I am unable to run the executable created by PyInstaller. I receive the following error message:
File "C:\MATLAB\R2020a\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\deployablepackage.py", line 33, in initialize
mcr_handle = self.__cppext_handle.startMatlabRuntimeInstance(self.__ctf_path)
SystemError: Cannot find CTF archive 'AppData\Local\...\[LibraryName]\[LibraryName].ctf'.
What does this error mean, and how can I fix this issue?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2022년 6월 22일
편집: MathWorks Support Team 2022년 6월 22일
Since you are able to run the program before it is built into an executable, the issue you are encountering may be caused by PyInstaller. By default, PyInstaller will not include the CTF file in the executable that it creates. To resolve this issue, you must create a SPEC file to instruct PyInstaller to include your CTF.
For an explanation of how to do this, please see the following MATLAB Answers post which gives an example of how to create a SPEC file for this purpose:
Additionally, PyInstaller has some documentation about these SPEC files that may be useful: 

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Python Package Integration에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by