필터 지우기
필터 지우기

Unable to run basic python commands despite building python with --enabled-shared on macOS Monterey

조회 수: 3 (최근 30일)
I've been building python locally to run with matlab. I have successfully built python in version 3.8.12, and 3.10.0 with the enabled-shared flag and created a virtual python enviroment using the venv package with the enviroment being called 'python-env'. I have sucessfully pointed to the right executable in matlab using the pyenv command and get the output shown below. But calling simple commands like py.open, or py.print("Hello") fail with the error line "Unable to resolve the name 'py.print'."
ans =
PythonEnvironment with properties:
Version: "3.8"
Executable: "/Users/adammurdock/Programming_Stuff/Reverb Project/python-env/bin/python"
Library: "/Users/adammurdock/.pyenv/versions/3.8.12/lib/libpython3.8.dylib"
Home: "/Users/adammurdock/Programming_Stuff/Reverb Project/python-env"
Status: NotLoaded
ExecutionMode: OutOfProcess

답변 (1개)

Dinesh
Dinesh 2023년 6월 5일
편집: Dinesh 2023년 6월 5일
Hello Adam,
If you encounter the error message 'Unable to resolve the name py.myFuncName' in MATLAB, it may be caused by installation issues related to Python. One possible reason for this error is a compatibility issue between Python and MATLAB. Specifically, only Python 3.10 is compatible with MATLAB R2023a and R2022b.
To resolve this issue, I recommend that you review the following MATLAB documentation. This should provide you with the necessary information to troubleshoot and fix the error.
  1. Configure Your System to Use Python
  2. Unable to resolve the name py.myfunc
  3. Versions of Python Compatible with MATLAB Products by Release
  4. Python virtual environments with MATLAB
Hope this helps!
Thank you.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by