在docker中无法使用tree命令,出现错误:/bin/sh:52:tree:notfound

问题描述 投票:0回答:1

我正在使用 docker,我想使用

tree
命令,但出现错误:

# tree -L 1
/bin/sh: 52: tree: not found
# whereis tree
tree:
# apt install tree
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package tree
# pip install tree
Requirement already satisfied: tree in /usr/local/lib/python3.8/site-packages (0.2.4)
Requirement already satisfied: Pillow in /usr/local/lib/python3.8/site-packages (from tree) (10.0.1)
Requirement already satisfied: svgwrite in /usr/local/lib/python3.8/site-packages (from tree) (1.4.3)
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packages (from tree) (57.0.0)
Requirement already satisfied: click in /usr/local/lib/python3.8/site-packages (from tree) (8.1.7)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
# tree -L 1
/bin/sh: 56: tree: not found
# 

我该怎么办?

python docker tree sh bin
1个回答
0
投票

根据@Klaus D.给出的解决方案。

首次运行命令:

apt update

然后运行命令:

apt install tree

现在可以使用

tree -L 1
命令了。

© www.soinside.com 2019 - 2024. All rights reserved.