How to create EXE using Python

  • Download and install python-3.7.4.exe (24MB)
pip install pyinstaller 
pyinstaller main.py --onefile --noconsole
  • Output: main.exe (8 MB) (8 seconds build time)

Note 1: The bundled app does not include any source code. However, PyInstaller bundles compiled Python scripts (.pyc files). These could in principle be decompiled to reveal the logic of your code.

Note 2: New versions of PyInstaller do not support Windows XP. If PyInstaller 3.2.1 works for you, just stay with that version.

Alternative Tool: py2exe

How to create EXE using PHP

Keras Project Example

Download pima indian diabetes data file first.

Python code:

from keras.models import Sequential
from keras.layers import Dense
import numpy
# fix random seed for reproducibility
numpy.random.seed(7)
# load pima indians dataset
dataset = numpy.loadtxt("pima-indians-diabetes.csv", delimiter=",")
# split into input (X) and output (Y) variables
X = dataset[:,0:8] #input data - except last column
Y = dataset[:,8] # last column is real results
# create model
model = Sequential()
model.add(Dense(12, input_dim=8, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
# Compile model
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# Fit the model - train
model.fit(X, Y, epochs=150, batch_size=10, verbose=2)

# evaluate the model
#scores = model.evaluate(X, Y)
#print("\n%s: %.2f%%" % (model.metrics_names[1], scores[1]*100))

# calculate predictions
predictions = model.predict(X)
rounded = [round(x[0],2) for x in predictions]
print(rounded)

Tested on: python-3.6.3-amd64, Keras API 2