Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

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

I am using the time library in Python (e.g. time.sleep(initial_delay)) via Google Collab for an ETL I'm making and want to specify it as a requirement for a web app.

Normally, I go to https://pypi.org/search/?q=time&o= and type a library to get the most recent version, but obviously there's 500 pages of time and none are obviously this library.

For some libraries, like pandas, there is this option but not for time:

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

I've tried:

import time
!pip list

But the library time is not in the list.

I've also tried:

import time
!pip show time

But I get:

WARNING: Package(s) not found: time

I've also tried:

import time
!pip freeze --all

But the library time (or any library involving the word 'time') is not there.

How can I see what version of a given library is in use by Python? I just need its version e.g. pandas==1.1.5 for my requirements.txt.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

time module is built-in python. Hence it only changes when your python version changes. and it does not have its own version.

refer to this answer to know more. Which version of python time module am I using


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...