当前位置: 首页 > 工具软件 > M64Py > 使用案例 >

ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py

杜阳炎
2023-12-01

1. 问题现象

在使用 pip 安装 pyinstaller 时,有如下错误

$ sudo pip3 install  pyinstaller==4.5.1   -i https://pypi.douban.com/simple/

Collecting pyinstaller==4.5.1
  Downloading https://pypi.doubanio.com/packages/a9/d9/9fdfb0ac2354d059e466d562689dbe53a23c4062019da2057f0eaed635e0/pyinstaller-4.5.1.tar.gz (2.7MB)
    100% |████████████████████████████████| 2.7MB 525kB/s 
Requirement already satisfied: altgraph in /usr/local/lib/python3.6/dist-packages (from pyinstaller==4.5.1)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in /usr/local/lib/python3.6/dist-packages (from pyinstaller==4.5.1)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from pyinstaller==4.5.1)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.6/dist-packages (from pyinstaller==4.5.1)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata->pyinstaller==4.5.1)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.6/dist-packages (from importlib-metadata->pyinstaller==4.5.1)
Installing collected packages: pyinstaller
  Running setup.py install for pyinstaller ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2xm0_yha/pyinstaller/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ur3vlz3l-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_bootloader
    No precompiled bootloader found. Trying to compile it for you ...
    Setting top to                           : /tmp/pip-build-2xm0_yha/pyinstaller/bootloader
    Setting out to                           : /tmp/pip-build-2xm0_yha/pyinstaller/bootloader/build
    Python Version                           : 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
    Checking for 'gcc' (C compiler)          : /usr/bin/gcc
    Checking size of pointer                 : 8
    Platform                                 : Linux-64bit-intel detected based on compiler
    Checking for compiler flags -m64         : yes
    Checking for linker flags -m64           : yes
    Checking for library dl                  : yes
    Checking for library pthread             : yes
    Checking for library m                   : yes
    Checking for library z                   : no
    The zlib development package is either missing or the shared library cannot be linked against. For security (and marginally better filesize), you should install the zlib-dev or zlib-devel packages with your system package manager and try again. If you cannot do this, for example distributions such as OpenWRT use sstrip on libraries making linking impossible, then either use the --static-zlib option or set the PYI_STATIC_ZLIB=1 environment variable. If you are installing directly with pip, then use the environment variable.
    (complete log in /tmp/pip-build-2xm0_yha/pyinstaller/bootloader/build/config.log)
    ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2xm0_yha/pyinstaller/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ur3vlz3l-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2xm0_yha/pyinstaller/

2. 解决方法

ubuntu 软件源里 zlibzlib-devel 叫做 zlib1g zlib1g.dev

sudo apt-get install zlib1g
sudo apt-get install zlib1g.dev

直接输入上述命令后如果还是不能安装。这就要求我们先装 ruby

sudo apt-get install ruby

然后再装 zlib1g-dev 就可以了

sudo apt-get install zlib1g-dev
 类似资料:

相关阅读

相关文章

相关问答