pyinstaller生成的exe文件不能在别人的电脑上使用

exe file produced by pyinstaller cannot be used in other's PC

我已经使用 pyinstaller 将 python.py 文件转换为可执行文件。可执行文件在我的电脑上工作,但在其他人的电脑上崩溃 computer.I 收到以下错误消息。

Failed to get ANSI buffer size <WideCharToMultiByte: parameter error
Failed to convert progname to wchar_t

可能是什么问题?

在微软的msdn上可以找到

Caution Using the WideCharToMultiByte function incorrectly can compromise the security of your application. Calling this function can easily cause a buffer overrun because the size of the input buffer indicated by lpWideCharStr equals the number of characters in the Unicode string, while the size of the output buffer indicated by lpMultiByteStr equals the number of bytes. To avoid a buffer overrun, your application must specify a buffer size appropriate for the data type the buffer receives. Data converted from UTF-16 to non-Unicode encodings is subject to data loss, because a code page might not be able to represent every character used in the specific Unicode data.

WideCharToMultiByte function

您可能会确保:

  • 您正在应用程序中使用 UTF 编码
  • 你在构建应用程序时包括了所有的 ddl(这可能是它在你的电脑上 运行 而不是其他人的另一个原因)