<bdo id='2s88D'></bdo><ul id='2s88D'></ul>
  • <tfoot id='2s88D'></tfoot>

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

        检查是否从 Python 安装了 Debian 软件包

        时间:2023-11-08

          <tfoot id='wo6ck'></tfoot>
        1. <legend id='wo6ck'><style id='wo6ck'><dir id='wo6ck'><q id='wo6ck'></q></dir></style></legend>
            <tbody id='wo6ck'></tbody>

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

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

                  本文介绍了检查是否从 Python 安装了 Debian 软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否有一种优雅且更像 Python 的方法来检查软件包是否安装在 Debian 上?

                  Is there an elegant and more Python-like way to check if a package is installed on Debian?

                  在 bash 脚本中,我会这样做:

                  In a bash script, I'd do:

                  dpkg -s packagename | grep Status
                  

                  建议在 Python 脚本中做同样的事情?

                  Suggestions to do the same in a Python script?

                  推荐答案

                  这是pythonic的方式:

                  This is a pythonic way:

                  import apt
                  cache = apt.Cache()
                  if cache['package-name'].is_installed:
                      print "YES it's installed"
                  else:
                      print "NO it's NOT installed"
                  

                  这篇关于检查是否从 Python 安装了 Debian 软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为什么在 Kubuntu 12.04 中安装 numpy 需要 python-dev 下一篇:PYTHONPATH 被忽略

                  相关文章

                  <tfoot id='eay8J'></tfoot>

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

                      • <bdo id='eay8J'></bdo><ul id='eay8J'></ul>

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