我收到一个错误:
Traceback (most recent call last):
File
"C:\Python33'lib\site-packages\cx_Freeze\initscripts\Console3.py",
line 27, in<module>
exec(code, m._dict))
File "smtpMail.py", line 30, in <module>
File "C:\Python33\lib\site-packages\VideoCapture\_init_.py",line
62, in_init_
os.path.join(_path_[0], 'helvetica-10.pil'))
File "C:\Python33\lib\site-packages\PIL\ImageFont.py", line 273, in
load_path
raise IOError(cannot find font file)
OSError: cannot find font file
图像错误,播放文件时: http ://s14.postimg.org/4pek1fwld/cx_Freeze.jpg
我的程序是基于模块的数量。在我的主文件 - 'smtpMail.py' 我的模块是:
import smtplib, platform, os, datetime
import socket
from VideoCapture import Device
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from win32com.client import GetObject
我认为我在构建 cx_Freeze 的 setup.py 文件中的错误我需要知道如何正确编辑 setup.py 文件。
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "smtpMail",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("smtpMail.py", base=base)])
请问谁能帮帮我?:)
更新:
问题出在“VideoCapture”模块中 - 我认为。我像这样编辑文件:
import sys
import smtplib, platform, os, datetime
import socket
from VideoCapture import Device
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from win32com.client import GetObject
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["smtplib","platform","os","datetime","socket","VideoCapture","PIL"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "smtpMail",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("smtpMail.py", base=base)])
而且它不起作用 - 再次犯了同样的错误。因此,我将 stmpMail.py 中与“VideoCapture”模块相关的所有内容都标记为注释。
和瓦拉!!exe文件工作。所以现在,谁能帮我,告诉我谁来修?
附言
我阅读了 cx-freeze 文档,
http://cx-freeze.readthedocs.org/en/latest/distutils.html
但这仍然对我没有帮助。请帮忙?:)