Use Matlab with not supported Py3.x version (e.g. ML 2021a with Py 3.9)?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I would like to use Matlab 2021a with py3.9. Unfortunately there 2021a only supports py 3.7 and 3.8. Is there any possibilty to enable ml 2021a to work with py 3.9?
0 commentaires
Réponses (1)
Walter Roberson
le 4 Août 2022
Yes, of course there is a possibility.
Python is open source code. You can get a copy of the 3.9 code and alter the numbering and recompile it, and install your customized version.
How well it will work...
5 commentaires
Walter Roberson
le 4 Août 2022
Modifié(e) : Walter Roberson
le 4 Août 2022
pyenv is built-in code, so you would have to figure out what it is supposed to do, and write your own version of it. You would place your version earlier on the path than the Mathworks version: files earlier on the path are used intead of files later on the path (generally speaking.)
pe = pyenv
It might be a bit tricky to create an object of the right class
which -all pyenv
!find /MATLAB/toolbox/matlab -name \*PythonEnvironment\* -print
Walter Roberson
le 4 Août 2022
It looks like possibly it uses
toolbox/matlab/external/interfaces/python/+python/+internal/pyinfo.m
which tells the python executable to run pyinfo.py to return information about the execution environment.
If that is what is getting invoked internally, then overriding it will take a bit of work. Earlier I said "generally speaking", but when that + folder structure is used and the internal code uses dot separated names like python.internal.pyinfo('C:\Python33\python.exe'), then that overrides the path for the most part... you would need to replace the entire python class to override an internal execution of python.internal.pyinfo (unless you executed the pyinfo.py into something that lied for you.)
Voir également
Catégories
En savoir plus sur Python Package Integration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!