How to get Spyder to open python scripts (.py files) directly from Windows Explorer

后端 未结 8 529
無奈伤痛
無奈伤痛 2020-12-29 07:10

I have recently installed the Anaconda distribution on Windows 7 (Anaconda 3-2.4.0-Windows-x86_64). Unlike IDLE, I can\'t right-click and open a py file in the Spyder IDE. I

8条回答
  •  悲哀的现实
    2020-12-29 07:23

    I have had a similar problem with another piece of software that I use.

    My work around for this problem is to set the file association for .py files to C:\Anaconda\Scripts\spider-script.py via the Open with dialog. If you now try to open your File.py by double clicking you'll receive an error like

    ~\file.py is not a valid Win32 application.

    This can be resolved by editing the spyder-script.py registry key:

    HKEY_USERS\S-1-5-21-3559708500-1520960832-86631148-1002\Software\Classes\Applications\spyder-script.py\shell\open\command
    

    and replacing the default value "C:\Anaconda\Scripts\spyder-script.py" %1 with "C:\Anaconda\python.exe" "C:\Anaconda\Scripts\spyder-script.py" %1. Use the search function for this key if the path isn't the same for your machine, and of course use the appropriate path for your python installation. spyder-script.py should now execute in a python shell.

    From the docstring of ftype,

    ...Within an open command string, %0 or %1 are substituted with the file name being launched through the association.

提交回复
热议问题