如何在Google Colab Notebook上的“!pip安装树”之后使“!树”工作?

时间:2019-06-08 16:05:20

标签: python tree google-colaboratory

我在Google colab笔记本上做了!pip install tree。它显示Pillow in /usr/local/lib/python3.6/dist-packages (from tree) (4.3.0)。但是当我使用!tree时。笔记本使我想起了bin/bash: tree: command not found。如何解决?

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

它显示:

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

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

1 个答案:

答案 0 :(得分:0)

您似乎对本地软件包管理器的点子感到困惑?

!apt-get install tree执行您想要的操作:

.
└── 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