Set Spyder as default Python

Medulla Oblongata picture Medulla Oblongata · Jul 9, 2014 · Viewed 22.3k times · Source

I've recently installed Anaconda (using the default settings) on Windows 7. When I try to open a .py file by double-clicking it, I get the Open with... option. How can I set the default program as Spyder?

Answer

xyzjayne picture xyzjayne · Feb 16, 2017

This is a variation based on Jose's solution of creating a .bat file that eventually worked for me.

Create a spyder.bat file with the following content:

start C:\YourPath\Anaconda2\pythonw.exe C:\YourPath\Anaconda2\cwp.py C:\YourPath\Anaconda2 "C:/YourPath/Anaconda2/pythonw.exe" "C:/YourPath/Anaconda2/Scripts/spyder-script.py" %1

Change YourPath to your actual Anaconda path. Other solutions didn't work for me, and the code here is inspired by Spyder shortcut's target.