Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
550 views
in Technique[技术] by (71.8m points)

python - Can I make a 32-bit program with cx_Freeze if I have a 64-bit OS?

I am currently running Windows 7 Home 64-bit and am working on a program that I would like to make available for both 32-bit and 64-bit Windows operating systems. When I use cx_Freeze to turn my .py to a .exe, it only allows it to be installed on 64-bit operating systems.

Would I need to buy a 32-bit computer to convert it to a 32-bit program or are there a special set of commands I can use to make cx_Freeze create both a 32-bit and a 64-bit exe?

from cx_Freeze import *
import sys

base = None

if sys.platform == 'win32':
    base = "Win32GUI"

executables = [Executable("iNTMI.py", shortcutName = "iNTMI", shortcutDir = "DesktopFolder", base = base, icon = "C:/Program Files/iNTMI/assets/images/programIcon.ico")]

setup(
    name = "iNTMI",                                            
    options = {"build_exe": {"packages": ["tkinter", "minecraftItems", "ProgFunctions", "minecraftItems"], "include_files": ["ProgFunctions.py", "minecraftItems.py"]}},
    executables = executables
    )
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No you do not need to buy another PC (thankfully) and no theirs no command for it either. If you want a 32bit .exe you just need an x32 bit Python installation and freeze it in the normal way and you will have a x32 executable. This will work on both x32 and x64 computers.

Since you are running x64 installation you can also create x64 .exe and have both x32 (if you get a x32 bit installation) and x64 .exe.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...