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

后端 未结 8 471
無奈伤痛
無奈伤痛 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:27

    What is working very well for me in Windows (10), is associating the *.py files with a batch file (let's say "SpyderBATCH.bat") containing this line :

    [ANACONDA_FOLDER_PATH]\pythonw.exe" "[ANACONDA_FOLDER_PATH]\cwp.py" "[ANACONDA_FOLDER_PATH]" "[ANACONDA_FOLDER_PATH]/pythonw.exe" "[ANACONDA_FOLDER_PATH]/Scripts/spyder-script.py" %1  
    

    Where [ANACONDA_FOLDER_PATH] has to be replaced with the full path to the Anaconda folder (usually under "Program Files").

    What Windows does, when double-clicking on a python script (let's say "file.py"), is pass to SpyderBATCH, as parameter number %1, the full path to "file.py".

    Then Spyder is launched and displays the script "file.py" in the editor view.

提交回复
热议问题