Ubuntu No such file or directory

ubuntu no such file or directory error

foreversmart write on 2020-06-26
最近在安装 Pytorch 工具的时候需要用到 conda 来进行安装
在安装 conda 工具的工程中执行安装脚本然后报错
bash Miniconda3-latest-Linux-x86.sh Miniconda3-latest-Linux-x86.sh: line 373: /root/miniconda3/pkgs/python-3.7.1-h0371630_7/bin/python3.7: No such file or directory
Shell
进入具体的 conda 安装目录发现这个 python 可执行文件是存在的
直接命令行执行这个可执行文件发现也会报相同的错误
查看文件的权限
ll miniconda3/pkgs/python-3.7.1-h0371630_7/bin/ total 9136 drwxr-xr-x 2 root root 4096 Dec 30 14:22 ./ drwxr-xr-x 8 root root 4096 Dec 30 10:55 ../ lrwxrwxrwx 1 root root 8 Dec 15 2018 2to3 -> 2to3-3.7* -rwxrwxr-x 1 root root 123 Dec 15 2018 2to3-3.7* lrwxrwxrwx 1 root root 7 Dec 15 2018 idle3 -> idle3.7* -rwxrwxr-x 1 root root 121 Dec 15 2018 idle3.7* lrwxrwxrwx 1 root root 8 Dec 15 2018 pydoc -> pydoc3.7* lrwxrwxrwx 1 root root 8 Dec 15 2018 pydoc3 -> pydoc3.7* -rwxrwxr-x 1 root root 106 Dec 15 2018 pydoc3.7* lrwxrwxrwx 1 root root 9 Dec 15 2018 python -> python3.7* lrwxrwxrwx 1 root root 9 Dec 15 2018 python3 -> python3.7* lrwxrwxrwx 1 root root 17 Dec 15 2018 python3-config -> python3.7m-config* -rwxrwxr-x 1 root root 9324184 Dec 15 2018 python3.7* lrwxrwxrwx 1 root root 17 Dec 15 2018 python3.7-config -> python3.7m-config* lrwxrwxrwx 1 root root 9 Dec 15 2018 python3.7m -> python3.7* -rwxrwxr-x 1 root root 3483 Dec 15 2018 python3.7m-config* lrwxrwxrwx 1 root root 10 Dec 15 2018 pyvenv -> pyvenv-3.7* -rwxrwxr-x 1 root root 463 Dec 15 2018 pyvenv-3.7*
Shell
发现也没有问题
然后想到会不会是具体的可执行文件的问题
查看当前系统的版本信息
uname -a Linux gpu-test 4.15.0-124-generic #127-Ubuntu SMP Fri Nov 6 10:54:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Shell
发现是 64 位的系统
查看当前可执行文件的信息
file miniconda3/pkgs/python-3.7.1-h0371630_7/bin/python3.7 miniconda3/pkgs/python-3.7.1-h0371630_7/bin/python3.7: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped
Shell
可以看到 ELF 32-bit LSB shared object 这是一个 32 位的可执行文件,所以会发生 No such file or directory 的错误
我们可以通过安装一些 兼容库的方法使 64 位的系统可以运行 32 位的程序
apt-get update apt-get install lib32ncurses5 lib32z1 Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: lib32tinfo5 libc-dev-bin libc6 libc6-dev libc6-i386 Suggested packages: glibc-doc The following NEW packages will be installed: lib32ncurses5 lib32tinfo5 lib32z1 libc6-i386 The following packages will be upgraded: libc-dev-bin libc6 libc6-dev 3 upgraded, 4 newly installed, 0 to remove and 25 not upgraded. Need to get 8376 kB of archives. After this operation, 13.4 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 libc6-dev amd64 2.27-3ubuntu1.4 [2585 kB] Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 libc-dev-bin amd64 2.27-3ubuntu1.4 [71.8 kB] Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 libc6 amd64 2.27-3ubuntu1.4 [2832 kB] Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 libc6-i386 amd64 2.27-3ubuntu1.4 [2650 kB] Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 lib32tinfo5 amd64 6.1-1ubuntu1.18.04 [79.1 kB] Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 lib32ncurses5 amd64 6.1-1ubuntu1.18.04 [100 kB] Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/main amd64 lib32z1 amd64 1:1.2.11.dfsg-0ubuntu2 [58.3 kB] Fetched 8376 kB in 0s (24.5 MB/s) Preconfiguring packages ... (Reading database ... 110351 files and directories currently installed.) Preparing to unpack .../libc6-dev_2.27-3ubuntu1.4_amd64.deb ... Unpacking libc6-dev:amd64 (2.27-3ubuntu1.4) over (2.27-3ubuntu1.3) ... Preparing to unpack .../libc-dev-bin_2.27-3ubuntu1.4_amd64.deb ... Unpacking libc-dev-bin (2.27-3ubuntu1.4) over (2.27-3ubuntu1.3) ... Preparing to unpack .../libc6_2.27-3ubuntu1.4_amd64.deb ... Unpacking libc6:amd64 (2.27-3ubuntu1.4) over (2.27-3ubuntu1.3) ... Setting up libc6:amd64 (2.27-3ubuntu1.4) ... Selecting previously unselected package libc6-i386. (Reading database ... 110351 files and directories currently installed.) Preparing to unpack .../libc6-i386_2.27-3ubuntu1.4_amd64.deb ... Unpacking libc6-i386 (2.27-3ubuntu1.4) ... Selecting previously unselected package lib32tinfo5. Preparing to unpack .../lib32tinfo5_6.1-1ubuntu1.18.04_amd64.deb ... Unpacking lib32tinfo5 (6.1-1ubuntu1.18.04) ... Selecting previously unselected package lib32ncurses5. Preparing to unpack .../lib32ncurses5_6.1-1ubuntu1.18.04_amd64.deb ... Unpacking lib32ncurses5 (6.1-1ubuntu1.18.04) ... Selecting previously unselected package lib32z1. Preparing to unpack .../lib32z1_1%3a1.2.11.dfsg-0ubuntu2_amd64.deb ... Unpacking lib32z1 (1:1.2.11.dfsg-0ubuntu2) ... Setting up libc6-i386 (2.27-3ubuntu1.4) ... Setting up lib32z1 (1:1.2.11.dfsg-0ubuntu2) ... Setting up libc-dev-bin (2.27-3ubuntu1.4) ... Setting up libc6-dev:amd64 (2.27-3ubuntu1.4) ... Setting up lib32tinfo5 (6.1-1ubuntu1.18.04) ... Setting up lib32ncurses5 (6.1-1ubuntu1.18.04) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for libc-bin (2.27-3ubuntu1.3) ...
Shell
再次执行 conda 的安装,发现已经可以成功安装了

「真诚赞赏,手留余香」

Foreversmart

真诚赞赏,手留余香

使用微信扫描二维码完成支付