title: How to ensure that Spyder runs within a conda environment?
body: <p>I created a conda environment called <code>testenv</code> in Windows 10 that contains Python 3.6 and Spyder.  I also installed Selenium using the method described in <a href="https://stackoverflow.com/a/46137861/4945268">this answer</a>.  I checked that these packages are installed with</p>
  
  <pre><code>conda list -n testenv
  </code></pre>
  
  <p>To run Spyder in that environment I followed the instructions in <a href="https://stackoverflow.com/a/30170469/4945268">this answer</a> and its related comments.  So I activated the environment with</p>
  
  <pre><code>activate testenv
  </code></pre>
  
  <p>which modified the prompt to indicate that <code>testenv</code> is active.  Then I typed</p>
  
  <pre><code>spyder
  </code></pre>
  
  <p>to launch Spyder.  (When Spyder opens, my command window automatically closes, and if I open another one without closing Spyder, and I issue the command <code>conda info -e</code>, the output indicates that <code>testenv</code> is no longer active.) At this point, when I run code within Spyder that contains the line</p>
  
  <pre><code>from selenium import webdriver
  </code></pre>
  
  <p>the Spyder console reports</p>
  
  <pre><code>ModuleNotFoundError: No module named 'selenium'
  </code></pre>
  
  <p>My questions are:</p>
  
  <p>Is Spyder really running in <code>testenv</code>?  If so, why is this error being reported?  If not, what am I doing wrong?</p>
  
  <hr>
  
  <p>EDIT: Further research turned up the aptly-named thread "<a href="https://stackoverflow.com/questions/34217175/spyder-does-not-run-in-anaconda-virtual-environment-on-windows-10">Spyder does not run in Anaconda virtual environment on Windows 10</a>".  I followed the suggestion, in the accepted answer, of installing Spyder after activating the environment, but that just returned the message</p>
  
  <pre><code># All requested packages already installed.
  # packages in environment at C:\Anaconda3\envs\testenv:
  #
  spyder                    3.2.2                    py36_0
  </code></pre>
  
  <p>One of that answer's comments suggests using <code>where spyder</code> within the active environment to check which executables are available.  This returned</p>
  
  <pre><code>C:\Anaconda3\Scripts\spyder.exe
  C:\Anaconda3\envs\testenv\Scripts\spyder.exe
  </code></pre>
  
  <p>So I tried starting Spyder by typing the full path of the second entry.  Spyder opened, and my program ran without errors.  <strong>This seems to have solved the problem.</strong></p>