ModuleNotFoundError; running python script in matlab script
11 ビュー (過去 30 日間)
古いコメントを表示
I have a python script that I want to run through MATLAB. I have installed python 3.9.2 for windows but when I run the following code:
system('python script_name.py');
I get the following error:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
EDIT: Restarting matlab made it work. However, i get this error now:
import numpy as n;
ModuleNotFoundError: No module named 'numpy'
This refers to the library numpy I assume.
0 件のコメント
回答 (2 件)
Rashed Mohammed
2021 年 3 月 11 日
Hi Maria
It seems that numpy module is not installed on your computer. You can install the python modules using the python package manager pip. Run "pip install <module_name>" to install the python module.
Hope this helps
0 件のコメント
Grace Kepler
2024 年 3 月 5 日
Since R2021b you can also run your Python file in MATLAB using "pyrunfile". This also allows you to return data to MATLAB.