...
We can directly call Python library functionality from MATLAB or write Python programs that work with MATLAB.
Versions of Python Compatible with MATLAB: For information on compatible Python versions, refer to the link: https://www.mathworks.com/support/requirements/python-compatibility.html
...
To check the Python version in the MATLAB, use the following command:
Code Block | ||
---|---|---|
| ||
>> pyenv ans = PythonEnvironment with properties: Version: "3.8" Executable: "/usr/local/lcls/package/anaconda/envs/python3_env/bin/python" Library: "/usr/local/lcls/package/anaconda/envs/python3_env/lib/libpython3.8.so" Home: "/usr/local/lcls/package/anaconda/envs/python3_env" Status: NotLoaded ExecutionMode: InProcess |
Note |
---|
The library conflicts between MATLAB's and Python's libraries could can result in segmentation faults. |
If the Python version in the MATLAB environment is different differs from the one in the Linux environment , which is (the released version used in DEV and PROD, you need to update the "startup.m" file , which is located at "$TOOLS/matlab/toolbox/."
Code Block | ||
---|---|---|
| ||
# A snippet of the file: if strcmp(version('-release'),'2020a') | strcmp(version('-release'),'2022b') | strcmp(version('-release'),'2023a') % Setup Python Environment: package_top = getenv('PACKAGE_TOP'); pyenv_path = [package_top '/anaconda/envs/python3_rhel7_env/bin/python']; pyenv('Version', pyenv_path,'ExecutionMode','InProcess'); %% Change default add-ons installation folder for Monkey Proof Code Checker theSettings = settings(); theSettings.matlab.addons.InstallationFolder.TemporaryValue = [package_top '/matlab/2020a/SupportPackages']; end |
...