3

I can install a python script as an exe file into "scripts" folder on windows.

  1. How can I just create an exe launcher for a script without installing it?

  2. Using 64-bit python, can I create an exe that will work with 32-bit python?

dot.Py
  • 4,831
  • 4
  • 26
  • 49
panda-34
  • 3,837
  • 17
  • 24

1 Answers1

1

Instead of using setuptools, you can use py2exe to create your executable files.

Just read the tutorial page to understand how to create them.

  1. Install it by typing in your terminal:

    pip install py2exe
    
  2. Create your .exe script (hello.py)

    print "hello world!"
    
  3. Create your setup config script (setup.py)

    from distutils.core import setup
    import py2exe
    
    setup(console=['hello.py'])
    
  4. Run your setup script by typing in your terminal

    python setup.py py2exe
    

    After that, 2 folders will be created inside the scripts folder.

    They'll be called 'dist' and 'build' folder.

    Inside the 'dist' folder you'll find an executable of your script.

    In our example, we compiled the hello.py file, correct? So, inside the dist folder we should find a hello.exe file.

Q: Also, using 64-bit python, can I create an exe that will work with 32-bit python?

A: No! You'll have to install a 32-bit python and compile using the 32-bit version.

Hint: create a virtual machine to compile your 32-bit programs.

Also you can take a look at:

Community
  • 1
  • 1
dot.Py
  • 4,831
  • 4
  • 26
  • 49