Python Error: ModuleNotFoundError: No module named 'numpy'
42 ビュー (過去 30 日間)
古いコメントを表示
I am trying to import some python code, but I get the following error.
>> pyversion
version: '3.6'
executable: 'C:\Users\LMKO\AppData\Local\Programs\Python\Python36\python.exe'
library: 'C:\Users\LMKO\AppData\Local\Programs\Python\Python36\python36.dll'
home: 'C:\Users\LMKO\AppData\Local\Programs\Python\Python36'
isloaded: 1
>> py.importlib.import_module('Python_my_functions_v0_1')
Error using Python_my_functions_v0_1><module> (line 1)
Python Error: ModuleNotFoundError: No module named 'numpy'
Error in <frozen importlib>_call_with_frames_removed (line 205)
Error in <frozen importlib>exec_module (line 678)
Error in <frozen importlib>_load_unlocked (line 655)
Error in <frozen importlib>_find_and_load_unlocked (line 950)
Error in <frozen importlib>_find_and_load (line 961)
Error in <frozen importlib>_gcd_import (line 978)
Error in __init__>import_module (line 126)
>> py.importlib.import_module('numpy')
Error using <frozen importlib>_find_and_load_unlocked (line 948)
Python Error: ModuleNotFoundError: No module named 'numpy'
Error in <frozen importlib>_find_and_load (line 961)
Error in <frozen importlib>_gcd_import (line 978)
Error in __init__>import_module (line 126)
3 件のコメント
Eric Delgado
2021 年 2 月 22 日
@Michalis Konstantinou, I figure out what happened with my issue... I had two instances of Python installed on my computer. So Matlab was pointing to the raw version of Python (without Numpy and others modules).
So I just configure the right version of Python and it's allright now. :)
pyenv('Version', 'C:\ProgramData\Anaconda3\python.exe')
I don't know if it's the same issue that you have, but you could try this solution. And obviously confirm that you do have installed Numpy module.
回答 (1 件)
surya venu
2024 年 4 月 2 日
Hi,
Here is a thing that you need to verify:
Check whether you have intalled "numpy", if not, you can install it viaa the following command:
> python -m pip install numpy
All the python dependencies needs to be installed seperately via "pip".
Additionally, make sure to setup the right python version before using it in MATLAB with "pyenv" command.
Hope it helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!