如何确定 Google 中的库版本 Collab 以确定应用程序的 requirements.txt?

How can I determine library version in Google Collab to determine app's requirements.txt?

我正在通过 Google 协作使用 Python 中的时间库(例如 time.sleep(initial_delay)),用于我正在制作并想要指定的 ETL它是网络应用程序的要求。

正常情况下,我会去https://pypi.org/search/?q=time&o=打一个库得到最新的版本,但是显然有500页的时间,none显然是这个库。

对于某些库,例如 pandas,有此选项但没有时间:

print(time.__version__)
AttributeError: module 'time' has no attribute '___version___'

我试过:

import time
!pip list

但是图书馆时间不在列表中。

我也试过:

import time
!pip show time

但我得到:

WARNING: Package(s) not found: time

我也试过:

import time
!pip freeze --all

但图书馆时间(或任何涉及单词 'time' 的图书馆)不存在。

如何查看 Python 使用的给定库的版本?我只需要它的版本,例如pandas==1.1.5 我的 requirements.txt.

内置时间模块python。因此,它只会在您的 python 版本更改时更改。而且它没有自己的版本。

请参阅此答案以了解更多信息。 Which version of python time module am I using