Skip to content Skip to sidebar Skip to footer

Python 3.5 App To .exe Or Copy Libraries To Another PC

I got the next problem. During the last 3 months, I was building an application in Python 3.5 to test luminaries. For this application I used the next libraries, 'tkinter', 'sys',

Solution 1:

I've used CX_Freeze on my programs in the past, so far I have only used it with python 3.4.3, but I see no reason why it shouldn't work with python 3.5.

You can also install it with pip:

pip install CX_Freeze

See here for a tutorial.

I'm out at the moment, so I'll comment the code I use when I next have my computer.

I hope this helps.

EDIT:

Here is a version of the code (for batch):

set PATH=%PATH%;C:\Python34\ python "setup.py" build pause

to use this code, you will need to make a setup script pointing to your program, an example is below:

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning. This example will include the os package, and omit the tkinter package
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "test",
        version = "0.1",
        description = "My GUI application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("test.py", base=base)])

EDIT2:

Although the above code does work, the code I use is:

cxfreeze "%cd%\File.py" --target-dir "%cd%\File\"


Post a Comment for "Python 3.5 App To .exe Or Copy Libraries To Another PC"