Set Spyder as default Python

孤人 提交于 2019-12-29 04:42:07

问题


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?


回答1:


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.




回答2:


Use the "Default Programs" interface and select the executable for your Spyder,try the "Set Associations" menu and use browse to select your executable.

The key is the executable path(set the path where the anaconda is installed): C:\path\Anaconda2\Scripts\spyder.exe

just need to be patient, to wait for a few seconds.




回答3:


You must create a spyder.bat file with the following content:

start C:\path\to\Anaconda3\pythonw C:\path\to\Anaconda3\Scripts\spyder-script.py  %1

Remember set the path where Anaconda is installed.
Then, use the Open with... dialog and select your new spyder.bat batch file.
It works on Windows 10 Home. I hope it works in Windows 7 too.




回答4:


When you get the Open With... dialog, select the "Select a program from a list of installed programs" option.

Then make sure the "Always use the selected program to open this kind of file" option is selected. Click "Browse" to point to the Spyder executable.



来源:https://stackoverflow.com/questions/24643474/set-spyder-as-default-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!