Trouble importing Python Modules in MATLAB

3 Ansichten (letzte 30 Tage)
Alex Weaver
Alex Weaver am 12 Mär. 2020
Kommentiert: Akshay Jajoo am 9 Sep. 2021
While I can run simple scripts, I cannot run scripts that import modules such as numpy or pathlib. While I realize this question has been asked many times before, I can't seem to find any of the files or succesfully change the MATLAB search path.
When running a scipt the error I get is:
ModuleNotFoundError: No module named 'numpy'
When attempting to use py.anything I get:
Unable to resolve the name py.importlib.import_module.
When I type pyversion nothing happens
I have Anaconda3 downloaded as well as CPython 64-bit. MATLAB version 2019b for reference.
I understand I have to fix the search path but when I add the path (or attempt to) nothing happens and I continue to get the same errors. Also I realize most of these issues are addressed in the documentation, but as someone not familiar with this software it is a little too tricky for me to figure out.

Antworten (1)

Harsha Priya Daggubati
Harsha Priya Daggubati am 16 Mär. 2020
Bearbeitet: Harsha Priya Daggubati am 16 Mär. 2020
Hi,
MATLAB does not support Anaconda Python. To call Python libraries from MATLAB, you need to install a supported version of the reference implementation (CPython) for Python. MATLAB supports versions 2.7, 3.5, and 3.6. You can download CPython from https://www.python.org/downloads/
You can also refer to the following threads in which relatable questions are asked:
Hope this helps!
  1 Kommentar
Akshay Jajoo
Akshay Jajoo am 9 Sep. 2021
@Harsha Priya Daggubati , Support for Matlab 2020A and 2020B is still the same 2.7, 3.5 and 3.6? Where can I find the information about the latest supported versions?
Also, when you say 3.6. Does it mean exactly 3.6 or any 3.6.x will work?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by