我想在第一时间使用CxFreeze。我还想实现日志记录模块,这是Python 3.6中的标准模块。 我安装了最新版本的CxFreeze(在5.1.1中)
这是我的代码!
from cx_Freeze import setup, Executable
import os,sys, logging
base = None
executables = [Executable("utt.py", base=base)]
packages = ["idna"]
includes = ["logging"]
options = {
'build_exe': {
'packages':packages,
'includes':includes
},
}
# On appelle la fonction setup
setup(
name = "Import ",
version = "1",
description = "Gestion rapide",
options = options,
executables = executables
)
,这里是错误消息
C:\Python\Python36\Scripts>C:\Python\Python36\Scripts\build\exe.win-amd64-3.6\utt.exe
2018-08-21 17:43:46.354712
2018-08-21-17-43-46
Traceback (most recent call last):
File "C:\Python\Python36\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Python\Python36\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "utt.py", line 16, in <module>
logging.basicConfig(filename=fileDate,level=logging.DEBUG,format='%(asctime)s %(levelname)s-8s %(message)s')
NameError: name 'logging' is not defined
请,我不明白为什么我的mdoule没有定义。我尝试过包含和打包属性,甚至使用include_files属性导入日志记录库。
致谢。