0

Now I'm developing a medium proj with python.

It has many modules and some of them are customize modules. And some of them are non-python files(may be config files), are need to use such as copy/paste (e.g when the client run this app and plug some the hw device, the app will config the hw device and copy the some file of app to hw device (may be ROM))

first my question is : can I create 1 single exe with all of my code, modules and non-python files?

if it is yes, how can I?

Thu Ra
  • 2,013
  • 12
  • 48
  • 76

2 Answers2

1

you could try changing your approach and putting all the files in the module as text. then you could use the py2exe to create executable and it would contain all the data you need. this approach makes sense only if you have some small files.

if you want to embed more and bigger files take a look at that solution: Py2exe: Embed static files in exe file itself and access them

Community
  • 1
  • 1
yemu
  • 26,249
  • 10
  • 32
  • 29
  • Py2exe is for Windows. Now, I'm trying to use pyinstaller. But I don't know how to put the modules and non-python files into a single exe. And I want to know if I put the non-python files into exe, how the application will use it. – Thu Ra Oct 23 '13 at 10:59
0
  1. open CMD
  2. Change path to PyInstaller directory.(ex-C:\PyInstaller-2.1)
  3. use this command

    pyinstaller.py my.py --noconsole --onefile --icon=icon.ico

change my.py to your script name.

--noconsole option remove the python console while executing your program. If you need console to get an output,just remove --noconsole
--onefile option makes all the modules and files in to one executable file.
--icon=icon.ico gives your exe an icon.Remember to put your icon file in Pyinstaller directory
Mathias Müller
  • 22,203
  • 13
  • 58
  • 75