DEV Community

vindianadoan
vindianadoan

Posted on

Setting anaconda Python as the default

Just documenting a quick note for me to refer back later.

Problem

When I was trying to check the AWS CLI version on my terminal, I get this warning in return:

Image description
which made me go: "Hang on, pretty sure I have anaconda installed".

It must be because when I was installing anaconda, I didn't pick the setting so that Python is added to the environment.

How to Fix It

Method 1: Run Command Prompt as Administrator:

Type the following commands, substituting the path to your Anaconda Python:

assoc .py=Python.File
ftype Python.File="C:\Users\YourName\anaconda3\python.exe" "%1" %*
Enter fullscreen mode Exit fullscreen mode

These commands tell Windows to associate .py with a “Python.File” type, and then map “Python.File” to your Anaconda Python executable.

Method 2: Use the Windows Default Apps Settings (No Admin Required):

  • Open Settings → Apps → Default apps.
  • Click Choose default apps by file type and scroll to .py.
  • Select the current default app (or “No default”) and browse to your Python interpreter (e.g. C:\Users\YourName\anaconda3\python.exe).

Now it's gone.

Image description

Top comments (0)