Python Mlab - cannot import name find_available_releases

前端 未结 2 2148
太阳男子
太阳男子 2021-02-15 16:11

I am new to Python. I am trying to run MATLAB from inside Python using the mlab package. I was following the guide on the website, and I entered this in the Python command line:

2条回答
  •  别那么骄傲
    2021-02-15 16:54

    You are right in saying that the find_available_releases() is not written. 2 ways to work this out

    • Check out the code in linux and work on it (You are working on windows !)
    • Change the Code as below

    Add the following function in matlabcom.py as in matlabpipe.py

    def find_available_releases():
        global _RELEASES
        if not _RELEASES:
            _RELEASES = list(_list_releases())
        return _RELEASES
    

    If you see mlabraw.py file, the following code will give you a clear idea why I am saying this !

    import sys
    is_win = 'win' in sys.platform
    if is_win:
        from matlabcom import MatlabCom as MatlabConnection
        from matlabcom import MatlabError as error
        from matlabcom import discover_location, find_available_releases
        from matlabcom import WindowsMatlabReleaseNotFound as MatlabReleaseNotFound
    else:
        from matlabpipe import MatlabPipe as MatlabConnection
        from matlabpipe import MatlabError as error
        from matlabpipe import discover_location, find_available_releases
        from matlabpipe import UnixMatlabReleaseNotFound as MatlabReleaseNotFound
    

提交回复
热议问题