Get date and time of installation for packages installed via pip

package, pip, python

Solution

Is this what you are looking for -

import pip
import os
import time

In [139]: for package in pip.get_installed_distributions():
   .....:          print "%s: %s" % (package, time.ctime(os.path.getctime(package.location)))
   .....:     
pyudev 0.17.dev20150317: Tue Mar 17 12:02:58 2015
python-magic 0.4.6: Fri Mar 20 14:07:59 2015
runipy 0.1.0: Fri Oct 31 01:49:34 2014

Source of the code - https://stackoverflow.com/a/24736563/170005

You can do `import pip` too, which is pretty interesting. I didn't know this.

Problem

I would like to find a way to get the calendar date and time in hour:minute:seconds format for my packages installed via pip. I would like to be able to see something in output like: Month/Day/Year - Hour:Minute:Seconds for each package.

Original source

Related problems