简体   繁体   中英

cannot open python script by double clicking

i have searched on multiple forums and looks like others met similar issues but I haven't read a straightforward explanation yet. what I am trying to do is to simply open my python script by double clicking it. it used to work, but not anymore. my python scripts can still be opened via idle. and executable when it is opened and F5 pressed.

if on windows or linux, right click, open with ... select python executable, or Idle. whichever you want the default action to be. then select the option to "always use this to open .py files"

If on a Mac, you can CTRL+Click the file, Get info > Open With and change it to Python Launcher. Click Change All. Double clicking should run the script.

Another way is to use pyinstaller which makes the script into an executable. It is pretty straightforward to use.

Change the "open with..." preference for the py files by shift + right click and choose open with from the menu. Make sure you tick the use always option

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM