在Windows上使用PyInstaller时缺少dll文件

4

当我运行以下代码时:

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)

环境:

  • Windows 10
  • Python 3.7.9
  • PyUpdater 3.1.1
  • Pyinstaller 4.1
2个回答

1

我已经卸载了所有的Python版本,安装了官方网站上的版本,现在它可以正常工作了。看起来Pyinstaller不能正确地与从Microsoft Store安装的Python配合使用。


0

可以在Github问题中找到解释。

  1. C:\Users(username)\AppData\Roaming\Python\Python37\Scripts 添加到用户路径中: 打开 '运行' 应用程序 -> 打开 'sysdm.cpl' -> '高级' -> '环境变量' -> 编辑用户变量中的 'Path'

  2. 复制包含您Python代码的 .py 文件到 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 文件夹中可用了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接