在PyInstaller下生成x32和x64版本

时间:2015-06-10 16:12:30

标签: python python-2.7 installation pyside pyinstaller

我已安装Python 2.7.xx x64并尝试使用PyInstaller构建可执行文件。

我是否有机会使用现有的Python x64构建x32和x64工件?

下面 app.spec 文件中显示的当前PyInstaller脚本:

  

pyinstaller src / app.spec

# -*- mode: python -*-
import os
import platform

from PySide import QtCore


onefile = False
console = False

platform_name = platform.system().lower()
app_name = {'linux': 'app',
            'darwin': 'app',
            'windows': 'app.exe'}[platform_name]

# Include imageformats plugins
plugins=os.path.join(os.path.dirname(QtCore.__file__), "plugins\\imageformats")
static_files = Tree(plugins, 'plugins\\imageformats')
static_files += [('app.ico', 'src\\app.ico', 'DATA')]

# Analyze sources
a = Analysis(['src\\app.py'],
             hiddenimports=['pkg_resources'],
             hookspath=None,
             runtime_hooks=None)

pyz = PYZ(a.pure)

if onefile:
    exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name=app_name,
        debug=False, strip=None, upx=True, console=console, icon='src/app.ico', version='src/app.ver')
else:
    exe = EXE(pyz, a.scripts, exclude_binaries=True, name=app_name, debug=False,
        strip=None, upx=True, console=console, icon='src/app.ico', version='src/app.ver')
    coll = COLLECT(exe, a.binaries, static_files, a.zipfiles, a.datas, strip=None, upx=True, name='app')

1 个答案:

答案 0 :(得分:1)

不,那不行。你应该做的是安装32位python并创建“其他”安装程序,开始创建过程。

可以在同一台机器上同时拥有相同Python major.minor版本的32位和64位版本。我有一个虚拟机,有32个 64位版本的2.7 / 2.6 / 3.3 / 3.4用于开发。 只有一个python(64位版本的2.7)在我的PATH中,它运行基于Python的所有其他东西(toxpy.testmercurial)。我指定完整路径(如C:\python\2.7-32\python.exe使用32位版本)。我为.whl生成ruamel.yaml个文件的批处理文件是:

c:\python\2.7\python.exe setup.py bdist_wheel
c:\python\2.6\python.exe setup.py bdist_wheel
c:\python\2.7-32\python.exe setup.py bdist_wheel
c:\python\2.6-32\python.exe setup.py bdist_wheel
c:\python\3.4\python.exe setup.py bdist_wheel
c:\python\3.3\python.exe setup.py bdist_wheel
c:\python\3.4-32\python.exe setup.py bdist_wheel
c:\python\3.3-32\python.exe setup.py bdist_wheel
c:\pypy2\2.5\pypy-2.5.1-win32\pypy.exe setup.py bdist_wheel

当然,确切的路径取决于您安装解释器的位置。