<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 软件包

        Check if a Debian package is installed from Python(检查是否从 Python 安装了 Debian 软件包)

          <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 软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Is there a way of group by month in Pandas starting at specific day number?( pandas 有从特定日期开始的按月分组的方式吗?)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                    <tfoot id='eay8J'></tfoot>

                      • <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'>

                              <tbody id='eay8J'></tbody>