我有一个包含图像作为数据文件的应用程序打包,我试图运行这个setup.py脚本:
from distutils.core import setup
import py2exe
import matplotlib
file_dati=[]
file_dati.append(matplotlib.get_py2exe_datafiles())
file_dati.append(('img1','C:UsersMZompetta.000Desktop20130114_assortimentiimg1.gif'))
setup(console=[{"script": "Int_assortimenti.py"}],
options = {
"py2exe": {
"dll_excludes": ["libzmq.dll", "MSVCP90.dll"]
}
}, data_files=file_dati
)
但是我得到了这个错误:
AttributeError: 'tuple'对象没有'split'属性
错误被引用到行:data_files=file_dati
我尝试了其他方法来组合数据文件,但是没有办法。
有人能帮我吗?
import os
import logging
from distutils.core import setup
import py2exe
import matplotlib
import shutil
distDir = "dist"
# Remove the build and dist folders
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("dist", ignore_errors=True)
try:
os.mkdir(os.path.abspath(distDir))
except:
logging.exception('')
data_files = matplotlib.get_py2exe_datafiles()
shutil.copyfile('C:UsersMZompetta.000Desktop20130114_assortimentiimg1.gif', os.path.join(distDir, "img1.gif"))
setup(
options = {"py2exe": {
"dll_excludes": ["libzmq.dll", "MSVCP90.dll"],
"dist_dir": distDir,
}
}
data_files = data_files,
console=[{"script": "Int_assortimenti.py"}],
)