WinPython Cannot run .py files directly (without s

2019-07-24 06:45发布

问题:

I want to distribute my python project to others so that they can run it without installing python 3.4 on their PCs (windows)

I have downloaded and extracted both the WinPython-32bit-3.4.4.6Qt5 and WinPython-64bit-3.4.4.6Qt5 packages - and with the help of Spyder - I ran my python scripts without any problem (on 2 different machines with 32 and 64 bit windows). (I copied my python scripts into the settings/.spyder-py3 folder - and opened an run it from spyder). This worked OK even on machines where python is not installed.

However, when I double click on the python script (with a .py extension) - I see that it does not start running automatically. Windows is asking me to select the program that shall run/open the file. This is happening both on win7 and win8.

This seems strange - because last night it worked OK on the machine with a different version of winPython (py version 3.5). Today even that version is not working.

Cannot find any advice or suggestions regarding this on WinPython documentation or in any other place on the net.

What am I doing wrong? Aren't the .py scripts supposed to run without Spyder being invoked first?

Any help shall be greatly appreciated.

回答1:

OK. If anyone is interested about how I solved this topic:

I had to perform winPython's 'Register Distribution' process on the client machine to achieve what I wanted. It can be accessed from the advanced menu option from the WinPython Control Panel that is distributed with the WinPython package.

(This somewhat 'registers' the distributed python exe to the clients computer - which enables all .py files in that computer to be interpreted by this new python exe delivered with the winPython package.)

I had to tell my client to perform this action before he could run the py files with a double click.