-->

How to install pyInstaller with Portable Python an

2019-07-18 19:17发布

问题:

Portable Python and Movable Python allow programming python without installing anythin, just by unpacking something. :-)

I'd like also to be able to create standalone executable from my scripts, nut I can't tie pyInstaller to these packages, as pyInstaller requires pyWin32, but pyWin32 relies on python registry signatures, and I have not them as I'm using portable version of python! Any workaround?

By unpacking pywin32 executable ( pywin32-217.win32-py2.7.exe) I get two folders, PLATLIB and SCRIPTS; maybe it's enough just to move these folder to the right Python Portable subfolder?

I'm using:

  • Windows XP
  • PortablePython_2.7.3.1 (Portable Python)
  • movpy-2.0.0-py2.5.1 (Movable Python)
  • pyinstaller-pyinstaller-v2.0-107-gecb2882 (PyInstaller)
  • pywin32-217.win32-py2.7 (PyWin32)

回答1:

Apparently it can be fixed by changing the order of imports. From the pyinstaller site:

In order to make pywin32 works with portable python pywintypes must be loaded before
any win32 library ....... Swapping the two lines "import win32api" and "import
pywintypes" in bindepend.py (line 44 and 45 on commit 0837e8a....) fixes the issue.

It fixed the same problem for me.