在 Windows 上使用 PyInstaller 缺少 dll 文件

Missing dll files using PyInstaller on Windows

我运行之后:

pyupdater build -F --app-version 0.0.1 app.py

我收到一个错误:

[INFO] PyUpdater 3.1.1
[INFO] Compiling...
Python library not found: libpython3.7.dll, libpython37m.dll, libpython3.7m.dll, python37.dll, libpython37.dll
    This would mean your Python installation doesn't come with proper library files.
    This usually happens by missing development package, or unsuitable build parameters of Python installation.
    * On Debian/Ubuntu, you would need to install Python development packages
      * apt-get install python3-dev
      * apt-get install python-dev
    * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)

环境:

github issue

中有说明
  1. 添加C:\Users(username)\AppData\Roaming\Python\Python37\Scripts到用户路径: 在用户变量

    中打开 'Run' app -> Open 'sysdm.cpl' -> 'Advanced' -> 'Environment Variables' -> Edit 'path'
  2. .py 文件(包含您的 python 代码的文件)复制到 C:\Users(username)\AppData\Roaming\Python\Python37\Scripts

  3. 运行 python -m pip install pyinstaller 在终端中安装 pyinstaller

  4. 运行 .\pyinstaller -w -F (your file name).py 在您的终端中将 python 文件转换为 .exe

现在 .exe 工具应该已经在 C:\Users(username)\AppData\Roaming\Python\Python37\Scripts\dist 文件夹中可用。

我删除了所有 Python 版本并安装了官方网站上的版本,现在可以使用了。从 Microsoft Store 安装的 Python 似乎 Pyinstaller 无法正常工作。