Start a conversation

Running Python Scripts from anywhere under Windows

To make Python scripts runnable from any location under Windows:

To call python scripts directly from the anaconda console command prompt, e.g., to invoke the script “” by typing:


instead of needing to type: 

> python path\to\ 

Please, follow these steps:

  1. Create directory to put all your python scripts in. E.g. "C:\Users\Your Name\My Scripts"
  2. Copy all your python scripts into this directory
  3. Add the path to this directory in Windows "PATH" system variable:
    Open Explorer
    Right-click on "My Computer"
    Click "Properties"
    Click "Advanced system settings"
    Select tab "Advanced"
    Click "Environment Variables"
    Select "Path"
    Click "Edit"
    Click "New"
    Add path to the created directory, e.g "C:\Users\Your Name\My Scripts"
  4. Run or restart "Anaconda Prompt"
  5. Type ""
  6. For the first time, windows asks what application to use to run *.py files.
    Select python in Anaconda directory: make sure check box "Always use this app to open .py files" is checked
    Click "More Apps"
    Click "Look for another app on this PC"
    Find path to anaconda python, e.g. "C:\Users\Your Name\Anaconda3\python"
    Click "Open"
    Click "OK"
  7. You should be able to run any of your python scripts from any directory now.
Choose files or drag and drop files
Was this article helpful?
  1. Nick Lovaas

  2. Posted