Skip to content Skip to sidebar Skip to footer

Creating Executable File Of My Python Script

I am trying to create an executable file out of my python script. System config : python --version : Python 2.7.15 :: Anaconda, Inc. conda : 4.3.

Solution 1:

  1. You should be able to run the following commands without errors in a Python console:

    import numpy
    print numpy.__version__
    import pandas
    print pandas.__version__
    

    If this does not work, you first need to (re-)install numpy and pandas in this order.

  2. In order to freeze a script depending on pandas (and thus on numpy) with cx_Freeze, you need to explicitly add numpy to the packages list of the build_exe options. Try with the following modification of your setup script:

     from cx_Freeze import setup, Executableoptions= {'build_exe': {'packages': ['numpy']}}
    
     setup(name = "Expiry" , 
           version = "1.0" , 
           description = "" ,
           options = options,  
           executables = [Executable("Expiry.py")])
    

    See Creating cx_Freeze exe with Numpy for Python.

Solution 2:

@jpeg as pointed out, here is my solution that worked after your recommendation.

from cx_Freeze import setup, Executableoptions= {'build_exe': {'packages': ['numpy'], 'include_files':['X:\Anaconda\Lib\site-packages\mkl_intel_thread.dll']} }

setup(name = "Expiry" , 
       version = "1.0" , 
       description = "" ,
       options = options,  
       executables = [Executable("Expiry.py")])

Post a Comment for "Creating Executable File Of My Python Script"