John,

you should read under

http://www.py2exe.org/index.cgi/SingleFileExecutable

   1 
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_1>
from distutils.core import setup   2
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_2>
import py2exe, sys, os   3
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_3>
   4 
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_4>
sys.argv.append('py2exe')   5
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_5>
   6 
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_6>
setup(   7 
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_7>
    options = {'py2exe': {'bundle_files': 1}},   8
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_8>
    windows = [{'script': "single.py"}],   9
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_9>
    zipfile = None,  10
<http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_10>
)


the documented secret lies with the bundle_files option.

This way you will get down to 1-3 files:

1.) the singe file exe containing Python, your programm and the depending
libraries
2.) 2 files from the Microsoft C-runtime.

on recent Windows usually those C-Runtimes are present. To get them mangled
into the single exe-file there is no ready made tool available; and the
majority agrees that those libraries would not be licenced for this usage
(they are licenced for redistribution).

best wishes,

Harald



2015-01-06 18:22 GMT+01:00 Harald Armin Massa[legacy] <
haraldarminma...@gmail.com>:

> John,
>
> you should read under
>
> http://www.py2exe.org/index.cgi/SingleFileExecutable
>
>    1 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_1>
>  from distutils.core import setup   2 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_2>
>  import py2exe, sys, os   3 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_3>
>     4 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_4>
>  sys.argv.append('py2exe')   5 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_5>
>     6 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_6>
>  setup(   7 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_7>
>      options = {'py2exe': {'bundle_files': 1}},   8 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_8>
>      windows = [{'script': "single.py"}],   9 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_9>
>      zipfile = None,  10 
> <http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_10>
>  )
>
>
> the documented secret lies with the bundle_files option.
>
> This way you will get down to 1-3 files:
>
> 1.) the singe file exe containing Python, your programm and the depending
> libraries
> 2.) 2 files from the Microsoft C-runtime.
>
> 2015-01-06 17:59 GMT+01:00 John Sampson <jrs....@ntlworld.com>:
>
>>  I tried py2exe but the executable file has to be in a specific folder
>> along with many other files that py2exe generates. It therefore cannot be
>> placed in any folder.
>> As far as I can see cx-freeze produces a folder, not a single file.
>>
>> I am looking for a way of producing a single executable file that can be
>> run in any folder, and nothing else - that is, standalone.
>>
>> Regards
>>
>> John Sampson
>>
>>
>> On 06/01/2015 13:07, Graeme Glass wrote:
>>
>> Yes it is.
>>
>>  http://www.py2exe.org/
>>  http://cx-freeze.sourceforge.net/
>>
>>
>>
>> On 6 January 2015 at 14:50, John Sampson <jrs....@ntlworld.com> wrote:
>>
>>> Is it possible to create a standalone executable (.EXE file) from a
>>> Python script?
>>>
>>> By 'standalone' I mean an executable file that can be placed in any
>>> folder and contains or finds the libraries, modules etc. that it depends on.
>>>
>>> Regards
>>>
>>> John Sampson
>>> _______________________________________________
>>> python-win32 mailing list
>>> python-win32@python.org
>>> https://mail.python.org/mailman/listinfo/python-win32
>>>
>>
>>
>>
>> _______________________________________________
>> python-win32 mailing list
>> python-win32@python.org
>> https://mail.python.org/mailman/listinfo/python-win32
>>
>>
>
>
> --
> LightningTalkMan
> a brand of GHUM GmbH
> Spielberger Straße 49
> 70435 Stuttgart
> 0173/9409607
>
>


-- 
LightningTalkMan
a brand of GHUM GmbH
Spielberger Straße 49
70435 Stuttgart
0173/9409607
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to