Python Error: ModuleNotFoundError: No module named 'numpy'
조회 수: 27 (최근 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!