title: Anaconda Python module importing issues when running Python script from batch file
body: <p>I want my Windows computer to automatically run a Python script every day, using the Task Scheduler. I wrote my Python Script using Spyder (Anaconda), and then I wrote a small batch file which looks like this:</p>
  
  <pre><code>set PATH="C:\ProgramData\Anaconda3\lib\site-packages";%PATH%
  "C:\ProgramData\Anaconda3\python.exe" "path\to\my\python\script.py"
  pause
  </code></pre>
  
  <p>note that I am manually adding <code>"C:\ProgramData\Anaconda3\lib\site-packages"</code> to my PATH variable, to ensure that my Anaconda Python distribution will correctly import the necessary modules, including <code>pandas</code> and <code>numpy</code>.</p>
  
  <p>But when I run this batch script, the following error happens:</p>
  
  <pre><code>Traceback (most recent call last):
    File "path\to\my\python\script.py", line 10, in &lt;module&gt;
      import pandas as pd
    File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in &lt;module&gt;
      "Missing required dependencies {0}".format(missing_dependencies))
  ImportError: Missing required dependencies ['numpy']
  </code></pre>
  
  <p>So it looks like Python wasn't able to import <code>numpy</code>, despite my specific action to add the <code>site-packages</code> folder to the PATH variable.</p>
  
  <p>How can I solve this issue?</p>
  
  <p><strong><em>EDIT: my question is quite similar to this one <a href="https://stackoverflow.com/q/46437863/6103050">Schedule a Python script via batch on windows (using Anaconda)</a></em></strong></p>