我想找到一种方法来获取我通过 pip 安装的包的小时:分钟:秒格式的日历日期和时间.
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.
谢谢!
这是你要找的 -
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
代码来源 - https://stackoverflow.com/a/24736563/170005
import pip 也可以,非常有趣.我不知道这个.
You can do import pip too, which is pretty interesting. I didn't know this.
这篇关于获取通过 pip 安装的软件包的安装日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
python:不同包下同名的两个模块和类python: Two modules and classes with the same name under different packages(python:不同包下同名的两个模块和类)
配置 Python 以使用站点包的其他位置Configuring Python to use additional locations for site-packages(配置 Python 以使用站点包的其他位置)
如何在不重复导入顶级名称的情况下构造python包How to structure python packages without repeating top level name for import(如何在不重复导入顶级名称的情况下构造python包)
在 OpenShift 上安装 python 包Install python packages on OpenShift(在 OpenShift 上安装 python 包)
如何刷新 sys.path?How to refresh sys.path?(如何刷新 sys.path?)
分发带有已编译动态共享库的 Python 包Distribute a Python package with a compiled dynamic shared library(分发带有已编译动态共享库的 Python 包)