构建时 Pyinstaller 出错

构建时 Pyinstaller 出错

我正在使用 Ubuntu 20.04 LTS。我正在尝试从我的 python 文件构建 exe 文件。但是在安装 requirements.txt 时遇到问题,我使用的是 Python 3.8.10 版本。

这些是错误:

Building wheels for collected packages: PyInstaller
  Building wheel for PyInstaller (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for PyInstaller (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_bootloader
      Setting top to                           : /tmp/pip-install-iy49ulu4/pyinstaller_c5cf1762e2fd49588e5f6007c79b4445/bootloader
      Setting out to                           : /tmp/pip-install-iy49ulu4/pyinstaller_c5cf1762e2fd49588e5f6007c79b4445/bootloader/build
      Python Version                           : 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
      Checking for 'gcc' (C compiler)          : /usr/bin/gcc
      Checking size of pointer                 : 8
      Platform                                 : Linux-64bit detected based on compiler
      Checking for program '/usr/bin/strip'    : /usr/bin/strip
      Checking for program 'strip'             : /usr/bin/strip
      Checking for library dl                  : yes
      Checking for library m                   : yes
      Checking for library z                   : not found
      The configuration failed
      (complete log in /tmp/pip-install-iy49ulu4/pyinstaller_c5cf1762e2fd49588e5f6007c79b4445/bootloader/build/config.log)
      No precompiled bootloader found. Trying to compile it for you ...
      ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py
      [end of output]

  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for PyInstaller
Failed to build PyInstaller
ERROR: Could not build wheels for PyInstaller, which is required to install pyproject.toml-based projects

我已附加屏幕截图以供进一步参考。

在此处输入图片描述

请帮我解决这个问题

答案1

您应该以非root用户身份运行以下命令。

pip3 install --upgrade pip

注销并重新登录,然后运行以下命令(再次以非 root 用户身份运行):

pip install --upgrade wheel
pip install --upgrade PyInstaller

相关内容