使用python3.5和cx-Freeze(4.3.4)和windows amd-64 我试图用这个命令构建exe:
python.exe setup.py build
Build不会产生任何错误。
my setup.py
import sys
from cx_Freeze import setup, Executable
setup(
name = "Calendar and Weather",
version = "1.0",
description = "",
executables = [Executable("cal.py")])
运行exe会产生错误:
AttributeError:module '_imp' has no attribue 'exec_builtin
这是我的_bootstrap文件
谷歌搜索不会产生这个特定问题的答案。
更新
I have run as suggested python setup.py bdist_msi. At the end of istall
there is a line
copying build\exe.win-amd64-3.5\cal.exe -> build\bdist.win-amd64\msi
But the last line of install says that directory were cal.exe been copied
to is deleted.
removing 'build\bdist.win-amd64\msi' (and everything under it)
I have as a result of the build two directories in built.
---- ------------- ------ ----
d----- 10/12/2015 3:27 PM bdist.win-amd64
d----- 10/12/2015 3:26 PM exe.win-amd64-3.5
bdist.win-amd64 is empty, and exe.win-amd64-3.5 has the exe, but it has
timestamp of my last attempt 10 days ago to build it ?
And it gives the same error. I have deleted the build folder and run
install again, but it did not help at all. Here what I have in
Directory: C:\Python35\Scripts\build\exe.win-amd64-3.5
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/2/2015 5:11 AM 1269248 cal.exe
-a---- 10/12/2015 3:26 PM 5110 library.zip
-a---- 9/13/2015 2:28 AM 3923736 python35.dll
-a---- 9/13/2015 2:29 AM 868632 unicodedata.pyd
-a---- 6/25/2015 11:15 PM 88752 VCRUNTIME140.dll
-a---- 9/13/2015 2:28 AM 87320 _bz2.pyd
in library.zip there is importlib folder
C:\Python35\Scripts\build\exe.win-amd64-3.5\library.zip\importlib and
it does contain __int__.pyc
PS C:\ Python35 \ Scripts> python setup.py bdist_msi 运行bdist_msi 运行构建 运行build_exe 创建目录build \ exe.win-amd64-3.5 复制C:\ Python35 \ lib \ site-packages \ cx_Freeze \ bases \ Console.exe - >建立\ exe.win-amd64-3.5 \ cal.exe 复制C:\ Python35 \ python35.dll - >建立\ exe.win-amd64-3.5 \ python35.dll 复制C:\ Python35 \ VCRUNTIME140.dll - >建立\ exe.win-amd64-3.5 \ VCRUNTIME140.dll *警告* 无法创建版本资源 首先安装pywin32扩展 编写zip文件build \ exe.win-amd64-3.5 \ library.zip
缺少模块: ?从dummy_threading导入的_dummy_threading ? _frozen_importlib_external从importlib导入,importlib._bootstrap ?从_strptime,cal__main__导入的日历 ?从os进口 ?从_strptime,cal__main__导入的datetime ?从heapq导入的doctest ?从base64,quopri导入的getopt ? json从cal__main__导入 ?从副本导入的org.python.core ?从os导入的os.path ?从os导入的posix ? pwd从posixpath导入 ?从cal__main__导入的请求 ?从os导入的子进程 这不一定是个问题 - 在这个平台上可能不需要这些模块。
复制C:\ Python35 \ DLLs_bz2.pyd - >建立\ exe.win,amd64-3.5_bz2.pyd 复制C:\ Python35 \ DLLs \ unicodedata.pyd - >建立\ exe.win-amd64-3.5 \ unicodedata.pyd 安装来构建\ bdist.win-amd64 \ msi 运行install_exe 创建build \ bdist.win-amd64 创建build \ bdist.win-amd64 \ msi 复制build \ exe.win-amd64-3.5 \ cal.exe - >建立\ bdist.win-AMD64 \ MSI 复制build \ exe.win-amd64-3.5 \ library.zip - >建立\ bdist.win-AMD64 \ MSI 复制build \ exe.win-amd64-3.5 \ python35.dll - >建立\ bdist.win-AMD64 \ MSI 复制build \ exe.win-amd64-3.5 \ unicodedata.pyd - >建立\ bdist.win-AMD64 \ MSI 复制build \ exe.win-amd64-3.5 \ VCRUNTIME140.dll - >建立\ bdist.win-AMD64 \ MSI 复制build \ exe.win-amd64-3.5_bz2.pyd - >建立\ bdist.win-AMD64 \ MSI 删除' build \ bdist.win-amd64 \ msi' (以及它下面的一切)
更新
I have started using pyinstaller instead. And it works fine for my. I have run
pyistaller with .\pyinstaller.exe --onefile .\cal.py and got what I wanted.