将我所有的 python 库包含到 py2exe 生成的 exe 中
Include all my python libraries to the exe generated by py2exe
我想包括我的 python.exe 用来编译的所有 python 库和依赖项以及 运行 我的计算机上的程序 ,进入py2exe生成的exe,
我想要那个,因为 py2exe **.exe* 生成的仍然返回错误并中止,
谢谢
这里是我在程序中使用的库:
from Tkinter import * # POUR L'interface graphique
import tkFileDialog # POUR l'ouverture d'
import csv
import ttk
import Tix as tix
import re # regular exprun fichier
import tkMessageBox # POUR un messageboxe pour quitter le programme
import py2exe, sys, os
import numpy as np
from threading import Thread
import datetime as dt
import pygal
from bokeh.plotting import figure, output_file, show
from datetime import datetime as time
import matplotlib.pyplot as plt
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib import cm
from matplotlib.dates import date2num
from matplotlib.gridspec import GridSpec
import matplotlib.dates as mdates
这是我的 setup.exe 脚本:
import sys
import os
import glob
import os.path
from distutils.core import setup
import py2exe
sys.setrecursionlimit(5000)
sys.argv.append('py2exe')
"""
setup(
options = {'py2exe': { 'compressed': True}},
windows = [{'script': "D:\Users\u156726\PycharmProjects\SFR_APP\SFR_APP_BIG_DATA.py"}],
zipfile = None,
)
"""
import matplotlib
import glob
setup(console=['D:\Users\u156726\PycharmProjects\SFR_APP\SFR_APP.py'],options={
'py2exe': {
'packages' : ['matplotlib', 'pytz'],
}
},
py2exe 提供 'options' 参数来定义要包含或排除的包列表。当缺少包时,您可以强制 py2exe 将这些包捆绑到 exe 中。
查看 docs 以了解有关所有选项的更多信息。
includes = ['matplotlib', 'numpy', 'Tkinter', 'tcl', 'Tkconstants', ... ]
excludes = ['_gtkagg', '_tkagg', 'curses', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs' ]
packages = []
dll_excludes = []
setup(
options = {"py2exe": {"compressed": 0,
"optimize": 0,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 1,
"dist_dir": ".",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
console=...,
)
我想包括我的 python.exe 用来编译的所有 python 库和依赖项以及 运行 我的计算机上的程序 ,进入py2exe生成的exe, 我想要那个,因为 py2exe **.exe* 生成的仍然返回错误并中止,
谢谢
这里是我在程序中使用的库:
from Tkinter import * # POUR L'interface graphique
import tkFileDialog # POUR l'ouverture d'
import csv
import ttk
import Tix as tix
import re # regular exprun fichier
import tkMessageBox # POUR un messageboxe pour quitter le programme
import py2exe, sys, os
import numpy as np
from threading import Thread
import datetime as dt
import pygal
from bokeh.plotting import figure, output_file, show
from datetime import datetime as time
import matplotlib.pyplot as plt
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib import cm
from matplotlib.dates import date2num
from matplotlib.gridspec import GridSpec
import matplotlib.dates as mdates
这是我的 setup.exe 脚本:
import sys
import os
import glob
import os.path
from distutils.core import setup
import py2exe
sys.setrecursionlimit(5000)
sys.argv.append('py2exe')
"""
setup(
options = {'py2exe': { 'compressed': True}},
windows = [{'script': "D:\Users\u156726\PycharmProjects\SFR_APP\SFR_APP_BIG_DATA.py"}],
zipfile = None,
)
"""
import matplotlib
import glob
setup(console=['D:\Users\u156726\PycharmProjects\SFR_APP\SFR_APP.py'],options={
'py2exe': {
'packages' : ['matplotlib', 'pytz'],
}
},
py2exe 提供 'options' 参数来定义要包含或排除的包列表。当缺少包时,您可以强制 py2exe 将这些包捆绑到 exe 中。
查看 docs 以了解有关所有选项的更多信息。
includes = ['matplotlib', 'numpy', 'Tkinter', 'tcl', 'Tkconstants', ... ]
excludes = ['_gtkagg', '_tkagg', 'curses', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs' ]
packages = []
dll_excludes = []
setup(
options = {"py2exe": {"compressed": 0,
"optimize": 0,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 1,
"dist_dir": ".",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
console=...,
)