I just finished my first program with python and would like to create an executable for distribution. However, I'm having a hard time doing this. I've tried using py2exe , pyinstaller and cx_freeze to no avail. After reading many opinions about it, I believe the best solution for my case is to use the pyinstaller , but I am not able to make the .exe file it creates work.
The imports I make in my program are below:
import os
import pygtk
import gtk
import MySQLdb
import getpass as gt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.io import sql
from scipy import stats, integrate
from scipy.optimize import curve_fit
import seaborn as sns
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import train_test_split
from sklearn import metrics
Reading the documentation for pyinstaller I've seen that the only libs
it does not support are scikit-learn
( sklearn
) and seaborn
. When I use pyinstaller --onefile Principal.py
the dist and build folder is created, but when I try to run the .exe file I get the following error message:
C: \ Users \ Lucas \ AppData \ Local \ Temp_MEI82242 \ gtk__init __. py: 127: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK Traceback (most recent call last): File "", line 13, in File "c: \ users \ lucas \ appdata \ local \ temp \ pip-build-6fpfyh \ pyinstaller \ PyInstall er \ loader \ pyimod03_importers.py ", line 363, in load_module File "c: \ users \ lucas \ anaconda \ lib \ site-packages \ pandas__init __. Py", line 13, in "extensions first.". format (module)) ImportError: C extension: lib not built. If you want to import pandas from the s ource directory, you may need to run 'python setup.py build_ext --inplace' to bu ild the C extensions first. Principal returned -1
Can anyone give me a light on how to do this?