error 3 on dateutil/zoneinfo using cx_freeze and p

2019-04-07 17:15发布

When I try to compile the hello.py file with cx_freeze, I get the following error with pandas 0.15.2 but no error with 0.15.1.

Has someone any idea on how to correct it ?

I have include the dateutil/zoneinfo files with the include_files function but the problem still occurs.

hello.py:

import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
print 'hello world'
df_dates = pd.date_range(start='01/01/2013', freq='H', periods=100)
df = pd.DataFrame(range(len(df_dates)), index=df_dates)
print df
print df.info()
df.plot()
plt.savefig('test.png')
plt.show(block=False)

setup.py :

includes = ['dateutil.zoneinfo', 'pandas']  # nommer les modules non trouves par cx_freeze
excludes = []
packages = ['os', 'matplotlib.backends.backend_qt4agg', 'dateutil', 'dateutil.zoneinfo', 'pandas']

# copier les fichiers non-Python et/ou repertoires et leur contenu:

def include_files():
        path_base = "C:\\Anaconda\\Lib\\site-packages\\dateutil\\zoneinfo\\"
        skip_count = len(path_base) 
        zip_includes = [(path_base, "dateutil/zoneinfo/")]
        for root, sub_folders, files in os.walk(path_base):
            for file_in_root in files:
                zip_includes.append(
                        ("{}".format(os.path.join(root, file_in_root)),
                         "{}".format(os.path.join("dateutil/zoneinfo", root[skip_count:], file_in_root))
                        ) 
                )      
        return zip_includes

includefiles = include_files()
zip_includes = include_files()

# niveau d'optimisation pour la compilation en bytecodes
optimize = 1
## if optimize = 2 :     read_frame.__doc__ += read_sql.__doc__
##                       TypeError: unsupported operand type(s) for +=: 'NoneType' and 'NoneType'

# si True, n'affiche que les warning et les erreurs pendant le traitement cx_freeze
silent = True

# construction du dictionnaire des options
options = {   #'path': path,
           'includes': includes,
           'excludes': excludes,
           'packages': packages,
           'include_files': includefiles,
           'zip_includes': zip_includes,
           #'bin_path_includes': binpathincludes,
           'create_shared_zip': True,  # <= ne pas generer de fichier zip
           'include_in_shared_zip': True,  # <= ne pas generer de fichier zip
           'compressed': True,  # <= ne pas generer de fichier zip
           'optimize': optimize,
           'silent': silent
           }


base = None

cible_1 = Executable('hello.py', targetName="hello.exe")
#base=base,
#compress=True,  # <= ne pas generer de fichier zip
#copyDependentFiles=True,
#appendScriptToExe=True,
#appendScriptToLibrary=True,  # <= ne pas generer de fichier zip
#icon=icone
#)

# On appelle la fonction setup
setup(
    name = "salut",
    author = 'XXX',
    version = "0.1",
    description = "Ce programme vous dit bonjour",
    options={"build_exe": options},
    executables = [cible_1],
)

The error is :

[Error 3] Le chemin dÆaccÞs spÚcifiÚ est introuvable: 'C:\\Users\\Utilisateur\\D
esktop\\compilation\\build\\exe.win-amd64-2.7\\library.zip\\dateutil\\zoneinfo/*
.*'
Traceback (most recent call last):
 File "C:\Anaconda\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
   exec(code, m.__dict__)
 File "hello.py", line 2, in <module>
 File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 7, in <module>
   from . import hashtable, tslib, lib
 File "ExtensionLoader_pandas_tslib.py", line 22, in <module>
 File "ExtensionLoader_pandas_tslib.py", line 14, in __bootstrap__
 File "pandas\tslib.pyx", line 44, in init pandas.tslib (pandas\tslib.c:79879)
 File "C:\Anaconda\lib\site-packages\dateutil\zoneinfo\__init__.py", line 32, i
n <module>
   ZONEINFOFILE = getzoneinfofile()
 File "C:\Anaconda\lib\site-packages\dateutil\zoneinfo\__init__.py", line 24, i
n getzoneinfofile
   filenames = os.listdir(os.path.join(os.path.dirname(__file__)))
WindowsError: [Error 3] Le chemin dÆaccÞs spÚcifiÚ est introuvable: 'C:\\Users\\
Utilisateur\\Desktop\\compilation\\build\\exe.win-amd64-2.7\\library.zip\\dateut
il\\zoneinfo/*.*'

0条回答
登录 后发表回答