我使用 py2exe 生成应用程序时没有问题。但是,当我执行 .exe 时,它会抛出下一个回溯:
Traceback (most recent call last):
File "editor.py", line 25, in <module>
File "moviepy\editor.pyo", line 72, in <module>
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'audio_fadein'
我以前使用 py2exe 并取得了成功,但现在我使用的是 moviepy 我无法使其工作。这是我的 setup.py,执行时没有错误python setup.py py2exe
:
from distutils.core import setup
from py2exe.build_exe import py2exe
import os
from distutils.filelist import findall
import matplotlib
datafiles = ['logo.png', 'Lower Brand.png', "icon.ico"]
matplotlibdatadir = matplotlib.get_data_path()
matplotlibdata = findall(matplotlibdatadir)
matplotlibdata_files = []
for f in matplotlibdata:
dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:])
matplotlibdata_files.append((os.path.split(dirname)[0], [f]))
mpl = matplotlib.get_py2exe_datafiles()
datafiles.extend(mpl)
setup(
name='VTE',
description="Video Test Editor",
version="1.0",
author="David Rodriguez",
data_files=datafiles,
console=[
{
'script':'videoeditor.py',
'icon_resources': [(1, r"icon.ico")]
}
],
options={ 'py2exe': {
'skip_archive':True,
'includes': ['sip', 'moviepy'],
'excludes': ['_gtkagg', '_tkagg', '_ssl'],
'optimize': 2,
'unbuffered': True
}
},
)