11
I just finished my first program with python and would like to create an executable for distribution.
However, I’m having trouble doing this. I’ve tried using py2exe, pyinstaller and cx_freeze without success. After reading many opinions about it, I believe that the best solution for my case is to use the pyinstaller, but I am unable to make the file . exe that 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 of pyinstaller I saw that the only libs
that he can’t stand are scikit-learn
(sklearn
) and seaborn
. When I use pyinstaller --onefile Principal.py
is created the dist and build folder, but when I try to run the file . exe 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) Import: 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. Main returned -1
Can someone give me a light on how to do this?
Error says: > you may need to run '
python setup.py build_ext --inplace
' Have you tried running this command?– Luis Felipe Kaufmann da silva
I’ve tried yes, but what would the setup.py file be? Because for pyinstaller you don’t need to create a setup file like py2exe.
– Lucas Kirsten
I would just like to leave commented that if your program is for users a little more than layman you can simply ask him to download python and run an installation script the famous setup.py, many programs are distibuted like this. If it is also for Ubuntu/Fedora users it is even easier.
– Samuel Haidu