爱看美女网爬虫【群辉Docker】【23.03.02】

在群辉下通过pyinstaller编译py文件会出现各种问题。首先是没有binutils,如果要安装这个工具包,需要安装包管理器ipkg。在确定系统处理器架构之后即可安装对应的包管理下,命令如下:

wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/stable/syno-i686-bootstrap_1.2-7_i686.xsh
chmod +x syno-i686-bootstrap_1.2-7_i686.xsh
sh syno-i686-bootstrap_1.2-7_i686.xsh

安装完成之后即可通过ipkg进行包管理了,

ipkg install binutils

在解决这个问题之后会出现另外一个问题,找不到ldd,从ubuntu系统下复制文件添加之后,继续编译就会出现下面的错误:

(spider) obaby@Venus:~/python_source$ pyinstaller --add-data "/var/services/homes/obaby/python_source/spider/lib/python3.8/site-packages/pyfiglet:pyfiglet" -F ikmn.py
143 INFO: PyInstaller: 5.9.0
144 INFO: Python: 3.8.12
145 INFO: Platform: Linux-4.4.180+-x86_64-with-glibc2.2.5
146 INFO: wrote /volume1/homes/obaby/python_source/ikmn.spec
148 INFO: UPX is not available.
150 INFO: Extending PYTHONPATH with paths
['/volume1/homes/obaby/python_source']
427 INFO: checking Analysis
438 INFO: Appending 'datas' from .spec
457 INFO: checking PYZ
465 INFO: checking PKG
466 INFO: Building because toc changed
466 INFO: Building PKG (CArchive) ikmn.pkg
5745 INFO: Building PKG (CArchive) ikmn.pkg completed successfully.
5788 INFO: Bootloader /volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run
5788 INFO: checking EXE
5789 INFO: Building because name changed
5789 INFO: Building EXE from EXE-00.toc
WARNING: The output directory "/volume1/homes/obaby/python_source/dist/ikmn" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
10258 INFO: Removing dir /volume1/homes/obaby/python_source/dist/ikmn
10387 INFO: Copying bootloader EXE to /volume1/homes/obaby/python_source/dist/ikmn
10389 INFO: Appending PKG archive to custom ELF section in EXE
Traceback (most recent call last):
  File "/volume1/homes/obaby/python_source/spider/bin/pyinstaller", line 8, in <module>
    sys.exit(_console_script_run())
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/__main__.py", line 194, in _console_script_run
    run()
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/__main__.py", line 180, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 979, in main
    build(specfile, distpath, workpath, clean_build)
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 901, in build
    exec(code, spec_namespace)
  File "/volume1/homes/obaby/python_source/ikmn.spec", line 24, in <module>
    exe = EXE(
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/building/api.py", line 594, in __init__
    self.__postinit__()
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/building/datastruct.py", line 173, in __postinit__
    self.assemble()
  File "/volume1/homes/obaby/python_source/spider/lib/python3.8/site-packages/PyInstaller/building/api.py", line 797, in assemble
    raise SystemError(f"objcopy Failure: {p.returncode} {p.stdout}")
SystemError: objcopy Failure: 1 objcopy:/volume1/homes/obaby/python_source/dist/ikmn: File format not recognized

嗯,这个办法目前不知道怎么解决。就让人很抑郁。

由于目前用的群辉是x86架构的,直接在ubuntu虚拟机上打包,此时运行会提示glibc版本错误:

obaby@Venus:~/python_source/dist/ikmn$ ./ikmn
[4908] Error loading Python lib '/volume1/homes/obaby/python_source/dist/ikmn/libpython3.8.so.1.0': dlopen: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /volume1/homes/obaby/python_source/dist/ikmn/libpython3.8.so.1.0)

嗯,这就很棒棒啊。同理,通过群辉的docker python环境打包的可执行文件也会提示上面的错误。glibc是基础库,所以我不是很想升级或者重新编译libc库。

但是直接在docker下运行是没问题的:

下载也没问题:

下载之后,如果直接运行有问题,可以通过创建python docker环境运行:

镜像选择ubuntu-python3

启动之后即可通过终端机运行爬虫。文件可以通过存储空间进行共享挂载:

文件哈希:

名称: ikmn_linuxx86.zip
大小: 8151192 字节 (7960 KiB)
CRC32: AADA7DCF
CRC64: 71F6130DA40B1FBD
SHA256: f8a285ae9a03a60d7ab40784dd3d8c68e35ed5e9589eef3fd888ff5b90f91795
SHA1: b0e01e99feaa5185a1d05f32f36693f9f3eec12a
BLAKE2sp: 8d5e167afbc10439430b40941c4602344e0c36d0781d0988d5b837718b25c1da

下载链接:

温馨提示: 此处隐藏内容需要发表评论,并且审核通过后才能查看。
(发表评论请勾选 在此浏览器中保存我的显示名称、邮箱地址和网站地址,以便下次评论时使用。
(请仔细检查自己的昵称和评论内容,以免被识别为垃圾评论而导致无法正常审核。)

☆版权☆

* 网站名称:obaby@mars
* 网址:https://oba.by/
* 个性:https://oba.by/
* 本文标题: 《爱看美女网爬虫【群辉Docker】【23.03.02】》
* 本文链接:https://lang.bi/2023/03/11533
* 短链接:https://oba.by/?p=11533
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。


You may also like

8 comments

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注