Use Matlab with not supported Py3.x version (e.g. ML 2021a with Py 3.9)?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Walter Roberson
2022 年 8 月 4 日
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 件のコメント
Walter Roberson
2022 年 8 月 4 日
編集済み: Walter Roberson
2022 年 8 月 4 日
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
2022 年 8 月 4 日
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.)
参考
カテゴリ
Help Center および File Exchange で Python Package Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!