gpt4 book ai didi

python - 如何使 '!tree' 在 '!pip install tree' 之后在 google colab 笔记本上工作?

转载 作者:行者123 更新时间:2023-12-01 00:51:52 24 4
gpt4 key购买 nike

我在 google colab 笔记本上执行了 !pip install tr​​ee 。它显示Pillow位于/usr/local/lib/python3.6/dist-packages(来自树)(4.3.0)。但是当我使用 !tree 时。笔记本提醒我bin/bash:tree:command not find。怎么解决?

我尝试了几次,但都失败了。

它显示:

Collecting tree
Downloading https://files.pythonhosted.org/packages/29/3f/63cbed2909786f0e5ac30a4ae5791ad597c6b5fec7167e161c55bba511ce/Tree-0.2.4.tar.gz
Requirement already satisfied: Pillow in /usr/local/lib/python3.6/dist-packages (from tree) (4.3.0)
Collecting svgwrite (from tree)
Downloading https://files.pythonhosted.org/packages/87/ce/3259f75aebb12d8c7dd9e8c479ad4968db5ed18e03f24ee4f6be9d9aed23/svgwrite-1.2.1-py2.py3-none-any.whl (66kB)
|████████████████████████████████| 71kB 23.9MB/s
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from tree) (41.0.1)
Requirement already satisfied: click in /usr/local/lib/python3.6/dist-packages (from tree) (7.0)
Requirement already satisfied: olefile in /usr/local/lib/python3.6/dist-packages (from Pillow->tree) (0.46)
Requirement already satisfied: pyparsing>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from svgwrite->tree) (2.4.0)
Building wheels for collected packages: tree
Building wheel for tree (setup.py) ... done
Stored in directory: /root/.cache/pip/wheels/c7/08/aa/42261411808c634cd1d0e9fe6cde5e78bf47c2c8028f3930af
Successfully built tree
Installing collected packages: svgwrite, tree
Successfully installed svgwrite-1.2.1 tree-0.2.4

!pip install tree
!tree

我希望它显示目录中文件的结构。

最佳答案

您似乎混淆了 pip 和本地包管理器?

!apt-get install tr​​ee 执行您想要的操作:

.
└── sample_data
├── anscombe.json
├── california_housing_test.csv
├── california_housing_train.csv
├── mnist_test.csv
├── mnist_train_small.csv
└── README.md

1 directory, 6 files

关于python - 如何使 '!tree' 在 '!pip install tree' 之后在 google colab 笔记本上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56507997/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com