title: conda python can't find library from command line, ImportError: DLL load failed: The specified module could not be found
body: <p>my python code works in spyder, but errors when run in cmd:</p>
  
  <pre><code>C:\Users\XYZ\AppData\Local\Continuum\anaconda3&gt;python.exe "C:\\Users\\XYZ\\project_1\\Model\\PPP_2_main.py"
  
  Traceback (most recent call last):
    File "C:\\Users\\XYZ\\project_1\\Model\\PPP_2_main.py", line 8,
   in &lt;module&gt;
      import numpy as np
    File "C:\Users\XYZ\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in &lt;module&gt;
      from . import _distributor_init
    File "C:\Users\XYZ\AppData\Local\Continuum\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 read <a href="https://stackoverflow.com/questions/51257233/python-importerror-dll-load-failed-the-specified-module-could-not-be-found">this</a> and it says python can't locate the module, and we need to add sys path. But isn't the error msg mentioning the correct path to the numpy library?</p>
  
  <p>Confirm the path to library is correct (in sypder):</p>
  
  <pre><code>import numpy 
  numpy.__file__
  Out[5]: 'C:\\Users\\XYZ\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\__init__.py'
  </code></pre>
  
  <p>Check conda env:</p>
  
  <pre><code>(base) C:\Users\XYZ&gt;conda env list
  # conda environments:
  #
  base                  *  C:\Users\XYZ\AppData\Local\Continuum\anaconda3
  </code></pre>
  
  <p>The path of the base env is where i was when running the code in cmd</p>
  
  <hr>
  
  <p>I read <a href="https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment" rel="nofollow noreferrer">this</a> and tried to activate conda, and it didn't work. In conda cmd:</p>
  
  <pre><code>(base) C:\Users\zhayuji&gt;conda activate base
  
  (base) C:\Users\zhayuji\AppData\Local\Continuum\anaconda3&gt;conda activate base
  
  (base) C:\Users\zhayuji\AppData\Local\Continuum\anaconda3&gt;conda list
  # packages in environment at C:\Users\zhayuji\AppData\Local\Continuum\anaconda3:
  
  #
  # Name                    Version                   Build  Channel
  _ipyw_jlab_nb_ext_conf    0.1.0                    py37_0
  _py-xgboost-mutex         2.0                       cpu_0
  alabaster                 0.7.12                   py37_0
  anaconda-client           1.7.2                    py37_0
  anaconda-navigator        1.9.7                    py37_0    anaconda
  ....
  numpy                     1.16.2           py37h19fb1c0_0
  numpy-base                1.16.2           py37hc3f5095_0
  numpydoc                  0.9.1                      py_0
  </code></pre>
  
  <p>After this i reopen cmd and ran python code, and it's the same err as at the beginning of the post.</p>