Running Matlab using Python gives 'No module named matlab.engine' error

前端 未结 2 1102
庸人自扰
庸人自扰 2020-12-11 19:11

I am trying to run Matlab code using Python. I tried to follow the instructions given on this Mathworks page.

When trying to import Matlab though Python, it was ins

相关标签:
2条回答
  • 2020-12-11 19:35

    pip install matlab gives you this, which installs a module with

    from numpy import *
    from pylab import *
    

    inside. I'm quite sure this is not what you wanted...

    I guess you tried importing the Matlab Compiler Runtime for Python. This has to be installed with the respective software from Mathworks though, it doesn't come through Python package index / pip. Check out the instrucions on their site.

    0 讨论(0)
  • 2020-12-11 19:43

    You need to install the Matlab Engine for Python, and it cannot be installed using pip. Try the instructions listed here. I have listed the instructions briefly below:

    1. Make sure you have Python in your PATH.
    2. Find the Matlab root folder. You can use the matlabroot command within Matlab to find it.
    3. Go to the Matlab root folder in the command line.
    4. cd "matlabroot\extern\engines\python" (In Windows)
    5. python setup.py install
    0 讨论(0)
提交回复
热议问题