在cx_freeze冻结Python应用程序中导入pandas非常慢

时间:2014-03-07 10:21:41

标签: python pandas cx-freeze

在我的cx_freeze冻结python应用程序中导入pandas需要8.5秒。

  • python 2.7 32bit和python 3.3 64bit
  • pandas 0.12.0

myprogram.py

while 1:
    input = raw_input(">>")
    if input == "quit()": break
    try:
        t = time.clock()
        exec(input, globals(), locals())
        print ("%f" % (time.clock() - t))
    except Exception as e:
        print (str(e))

setup.py

from cx_Freeze import setup, Executable


build_exe_options = {
"includes": ['pandas'],
"packages": [],
'excludes' : ['PyQt4.uic.port_v3', 'Tkconstants', 'tcl', 'tk', 'doctest', '_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'Tkinter', 'tables', 'zmq', 'win32', 'Pythonwin', 'Cython', 'statmodels', 'cvxopt', '_sqlite3', '_ssl', '_testcapi', 'markupsafe', 'numexpr', '_elementtree', '_hashlib', '_testcapi', 'bz2', 'simplejson', 'pyexpat', 'lxml', 'matplotlib', 'guidata', 'PyQt4', 'PySide', 'scipy', '_multiprocessing', '_ctypes', 'PIL'],

"include_files": []}

setup(
name = "my_program",
version="2.0.0",
description="",
author = "",
options = { "build_exe": build_exe_options},
executables = [Executable("my_program.py", shortcutName="my_program", shortcutDir="DesktopFolder")])

在my_program.exe中

>>import pandas
8.579099

我做错了吗?

0 个答案:

没有答案