title: how to run a python script (with Anaconda packages) on Matlab?
body: <p>I'm trying to run a python script, which uses several Anaconda packages (python 3.7), in Matlab (i'd like to use fmincon, using an already existent python script for the evaluation of objective function and constraints.), but I can't cope with. The OS is Windows 7.</p>
  
  <p>I have already read some topics on internet, and I found a couple of possible ways to deal with the issue, but none seems to work!</p>
  
  <p>If I write directly in the windows cmd </p>
  
  <pre><code>conda activate base
  cd &lt;path to  the folder of myscript&gt;
  python &lt;myscript&gt;.py 
  </code></pre>
  
  <p>all work. But if I write these lines in a .bat file to be invoked (system('.bat')) by matlab,
  I get the following error:</p>
  
  <pre><code>&lt;path to the folder of myscript&gt; &gt;python &lt;myscript&gt;.py   
  Traceback (most recent call last): 
    File "myscript.py", line 30, in &lt;module&gt; 
      from polars import readPolars  # a module of mine
    File "&lt;path to  the folder of myscript&gt;\polars.py", line 25, in &lt;module&gt; 
      from numpy import triu_indices, zeros, triu, ones, empty 
    File "C:\Users\tesisti\Anaconda3\Lib\site-packages\numpy\__init__.py", line 140, in &lt;module&gt; 
      from . import _distributor_init 
    File "C:\Users\tesisti\Anaconda3\Lib\site-packages\numpy\_distributor_init.py", line 34, in &lt;module&gt; 
      from . import _mklinit 
  ImportError: DLL load failed: The specified module could not be found. 
  </code></pre>
  
  <p>I have also read that is can be due to the fact that anaconda and matlab do not have the same PATH environmental variables, so that I should add manually. However, it is not clear to me how to do.</p>
  
  <p>Could someone help me? Also proposing new strategies?</p>
  
  <p>Thank you.</p>
  
  <p>Marco</p>