[Python 2.7]包含Pynsist的程序包

时间:2017-09-04 09:28:51

标签: linux python-2.7 pygame packaging pynsist

我正在使用最新版本的Pynsist打包Python 2.7程序 我在this示例后创建了一个installer.cfg文件 但是当我尝试打包运行

的应用程序时
pynsist installer.cgf

进入应用程序文件夹,它出现

Copying Python installer to build directory
PyLauncher MSI already in build directory.
Copying packages into build directory...
Traceback (most recent call last):
  File "/usr/local/bin/pynsist", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/nsist/__init__.py", line 540, in main
    InstallerBuilder(**args).run(makensis=(not options.no_makensis))
  File "/usr/local/lib/python2.7/dist-packages/nsist/__init__.py", line 495, in run
    self.prepare_packages()
  File "/usr/local/lib/python2.7/dist-packages/nsist/__init__.py", line 381, in prepare_packages
    py_version=self.py_version, exclude=self.exclude)
  File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 224, in copy_modules
    mc.copy(modname, target, exclude)
  File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 195, in copy
    check_package_for_ext_mods(path, self.py_version)
  File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 41, in check_package_for_ext_mods
    check_ext_mod(os.path.join(path, dirpath, filename), target_python)
  File "/usr/local/lib/python2.7/dist-packages/nsist/copymodules.py", line 30, in check_ext_mod
    raise ExtensionModuleMismatch(extensionmod_errmsg % ('Windows', path))
nsist.copymodules.ExtensionModuleMismatch: Found an extension module that will not be usable on Windows:
/usr/lib/python2.7/dist-packages/pygame/rwobject.so
Put Windows packages in pynsist_pkgs/ to avoid this.

所以我认为问题出在Pygame上。

在Google上没有任何相关内容,但我无法使用其他程序进行打包(例如.py2exe,pyinstaller ecc ...)。
谢谢,对不起英语不好

1 个答案:

答案 0 :(得分:1)

重新作为答案,因为它有效:

如果您将pygame放在packages=中,它会尝试从您的计算机中复制它。但是在你的计算机上,这是Linux的pygame,它不能在Windows上运行。如果您将pygame放在配置文件的pypi_wheels=位中,Pynsist将负责为您下载Windows版本。

查看Pynsist存储库中的the pygame example

大多数软件包都没有这个问题,因为它们只包含Python代码,这是所有平台上的相同文件。 Pygame编译了模块,必须为正确的平台编译。