Using Matlab.engine and installing tensorflow at the same time
조회 수: 3(최근 30일)
표시 이전 댓글
Malaika Cheema 2022년 1월 20일
답변: Yongjian Feng 2022년 1월 20일
Currently I am working on a project with Jupyter Notebook in which I need to run a matlab script (.m) which includes a function that provides me with data which i try to solve with a tensorflow model afterwards. I can set up an environment that runs the matlab code an gives me the data and I can set up an environment that does the tensorflow thing but my problem is I can`t do it in the same environment.
Here is the setup and the problems. I am using matlab.engine which I installed like described here: https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html To run my Jupyter Notebook I first navigate to the location where my python.exe and the matlab files are lying ("C:\Users\Philipp\AppData\Local\Programs\Python\Python37-32\Scripts"). If I try to run pip install tensorflow (in Anaconda Prompt) I got a lot of different errors like the following. Conda install works but even when it is installed i can`t import it.
ImportError: No module named 'tensorflow.core' or ERROR: Could not find a version that satisfies the requirement tensorflow or just No module named 'tensorflow'
I searched for all those problems but nothing helped me. I think this has something to do with the directory I am working in and I know it is bad but I have no idea how to change that. The error also occurs in different environments.
Yongjian Feng 2022년 1월 20일
So the current hurdle is about installing/importing tensorflow, right?
For the Anaconda installing issue, you might get better help from Anaconda's forum.
As for Conda, it seems like the installation is done? Is it successful? Any error message during installation? If it is installed correctly, maybe the problem is just where to find the installed package. Try to play with the environment variable PYTHONPATH to point to the installed location.
Find more on Call MATLAB from Python in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!