MATLAB Answers

How to add the path to a local python file to be executed by a Matlab script?

9 views (last 30 days)
Hi,
I want to execute a python function from a Matlab script. How can I add the path to the local python file to be visible to the Matlab script?
Thanks

Accepted Answer

Jaime Trivino
Jaime Trivino on 15 Sep 2021
I have founf that we can define the path to our own python environment (conda)
pyenv("Version","C:\path to\anaconda3\envs\myenv\python.exe")

More Answers (1)

Yongjian Feng
Yongjian Feng on 12 Sep 2021
Python uses an env var called PYTHONPATH to point to packages/scripts. So inside matlab, you just need to add the path you want to that env var following this: set env var

Community Treasure Hunt

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

Start Hunting!

Translated by