• <bdo id='o1639'></bdo><ul id='o1639'></ul>
  1. <small id='o1639'></small><noframes id='o1639'>

  2. <tfoot id='o1639'></tfoot>
    <i id='o1639'><tr id='o1639'><dt id='o1639'><q id='o1639'><span id='o1639'><b id='o1639'><form id='o1639'><ins id='o1639'></ins><ul id='o1639'></ul><sub id='o1639'></sub></form><legend id='o1639'></legend><bdo id='o1639'><pre id='o1639'><center id='o1639'></center></pre></bdo></b><th id='o1639'></th></span></q></dt></tr></i><div id='o1639'><tfoot id='o1639'></tfoot><dl id='o1639'><fieldset id='o1639'></fieldset></dl></div>

      <legend id='o1639'><style id='o1639'><dir id='o1639'><q id='o1639'></q></dir></style></legend>

      查看何时使用 pip 安装/更新软件包

      时间:2023-09-14
      <legend id='Fokvh'><style id='Fokvh'><dir id='Fokvh'><q id='Fokvh'></q></dir></style></legend>

          • <i id='Fokvh'><tr id='Fokvh'><dt id='Fokvh'><q id='Fokvh'><span id='Fokvh'><b id='Fokvh'><form id='Fokvh'><ins id='Fokvh'></ins><ul id='Fokvh'></ul><sub id='Fokvh'></sub></form><legend id='Fokvh'></legend><bdo id='Fokvh'><pre id='Fokvh'><center id='Fokvh'></center></pre></bdo></b><th id='Fokvh'></th></span></q></dt></tr></i><div id='Fokvh'><tfoot id='Fokvh'></tfoot><dl id='Fokvh'><fieldset id='Fokvh'></fieldset></dl></div>

          • <tfoot id='Fokvh'></tfoot>
              • <bdo id='Fokvh'></bdo><ul id='Fokvh'></ul>
                  <tbody id='Fokvh'></tbody>

                <small id='Fokvh'></small><noframes id='Fokvh'>

                本文介绍了查看何时使用 pip 安装/更新软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我知道如何使用 pip 查看已安装的 Python 包,只需使用 pip freeze.但是有什么方法可以查看使用 pip 安装或更新包的日期和时间?

                I know how to see installed Python packages using pip, just use pip freeze. But is there any way to see the date and time when package is installed or updated with pip?

                推荐答案

                如果不需要区分更新和安装,可以使用包文件的更改时间.

                If it's not necessary to differ between updated and installed, you can use the change time of the package file.

                就像 Python 2 一样,带有 pip <10:

                Like that for Python 2 with pip < 10:

                import pip, os, time
                
                for package in pip.get_installed_distributions():
                     print "%s: %s" % (package, time.ctime(os.path.getctime(package.location)))
                

                或类似的更新版本(使用 Python 3.7 测试并安装了带有 pkg_resources 的 setuptools 40.8):

                or like that for newer versions (tested with Python 3.7 and installed setuptools 40.8 which bring pkg_resources):

                import pkg_resources, os, time
                
                for package in pkg_resources.working_set:
                    print("%s: %s" % (package, time.ctime(os.path.getctime(package.location))))
                

                在这两种情况下,输出都将类似于 numpy 1.12.1: Tue Feb 12 21:36:37 2019.

                an output will look like numpy 1.12.1: Tue Feb 12 21:36:37 2019 in both cases.

                顺便说一句:您可以使用 pip list 而不是使用 pip freeze,它能够提供更多信息,例如通过 pip list -o.

                Btw: Instead of using pip freeze you can use pip list which is able to provide some more information, like outdated packages via pip list -o.

                这篇关于查看何时使用 pip 安装/更新软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                • <bdo id='Eyi8N'></bdo><ul id='Eyi8N'></ul>
                  <legend id='Eyi8N'><style id='Eyi8N'><dir id='Eyi8N'><q id='Eyi8N'></q></dir></style></legend>
                  1. <i id='Eyi8N'><tr id='Eyi8N'><dt id='Eyi8N'><q id='Eyi8N'><span id='Eyi8N'><b id='Eyi8N'><form id='Eyi8N'><ins id='Eyi8N'></ins><ul id='Eyi8N'></ul><sub id='Eyi8N'></sub></form><legend id='Eyi8N'></legend><bdo id='Eyi8N'><pre id='Eyi8N'><center id='Eyi8N'></center></pre></bdo></b><th id='Eyi8N'></th></span></q></dt></tr></i><div id='Eyi8N'><tfoot id='Eyi8N'></tfoot><dl id='Eyi8N'><fieldset id='Eyi8N'></fieldset></dl></div>
                    <tfoot id='Eyi8N'></tfoot>

                    • <small id='Eyi8N'></small><noframes id='Eyi8N'>

                          <tbody id='Eyi8N'></tbody>