Specifying Windows to use Anaconda Python interpreter

Viewed 854

I have Python 2.7 installed and I have Anaconda (using Python 3.6) installed on Windows. Whenever I try to run my .py scripts from Windows outside of the Anaconda environment Windows defaults to using the Python 2.7 interpreter. My Scripts fail to import modules (i'm assuming this is using the wrong interpreter).

I have tried changing the path variable as per this post How should I set the default Python version in Windows and this post Changing python interpreter windows. I have also tried changing the default .exe from the 2.7 version to the Python.exe in Anaconda directly from the command line.

Is there anything I need to consider that Anacondas version is in "C:\Users\william\AppData\Local\Continuum\anaconda3\python.exe"? All other posts refer to Python.exe as being in something like "C://python27/". I am expecting to be able to set the default interpreter to use from the above location and set this to be the default for .py files.

Current Python Version:

enter image description here

Assuming this is from:

enter image description here

I am assuming I want to use this version:

enter image description here

I have tried adding the below to the user and system path variables:

enter image description here

1 Answers

Another solution which worked for me.

  • Open Command Prompt and type where python. For me:
C:\Users\user\anaconda3\python.exe
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe

I am going to use the first path to the python interpreter because it relates to Anaconda.

  • Following this tutorial, I added C:\Users\user\anaconda3\Scripts\ and C:\Users\user\anaconda3\ to the Path variable in the system variables section of Environment Variables.
Related