matlab python engine module not recognized
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am having trouble using the matlab python engine. I tried this piece of code from the mathworks website:
import matlab.engine
if __name__ == '__main__':
eng = matlab.engine.start_matlab()
x = 4.0
eng.workspace['y'] = x
a = eng.eval('sqrt(y)')
print(a)
pass
But pycharm is giving me an error saying "ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is not a package". I am using python 3.6 and matlab 2018. I saw that these are the supported versions on website, I saw a similar post about this problem but I can't even run my program from python command line. I also can't find teh matlab.py in my python site-packages, although I have the matlab folder in packages.
0 comentarios
Respuestas (1)
Meet
el 17 de En. de 2025
Hi Shiping,
To resolve this issue, you need to install the MATLAB Engine API for Python:
First ensure that you have correct version of python installed and accessible using command line.
Then open a command prompt and navigate to the MATLAB engine directory:
cd "matlabroot\extern\engines\python"
Replace 'matlabroot' with your MATLAB installation directory.
Install MATLAB API using 'pip' command:
python -m pip install .
To get the detailed instructions on the same, please follow this documentation link:
0 comentarios
Ver también
Categorías
Más información sobre Call MATLAB from Python en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!