title: How to install a package using the python-apt API
body: <p>I'm quite a newbie when it comes to Python, thus I beg foregiveness beforehand :). That said, I'm trying to make a script that, among other things, installs some Linux packages. First I tried to use subopen as explained <a href="https://stackoverflow.com/questions/8481943/using-apt-get-install-xxx-inside-python-script">here</a>. While this can eventually work, I stumbled upon the <a href="http://apt.alioth.debian.org/python-apt-doc/" rel="noreferrer">python-apt API</a> and since I'm not a big fan or re-inventing the wheel, I decided to give a try.</p>
  
  <p>Problem comes when trying to find examples/tutorials on installing a package using python-apt. Searching the documentation I found the <a href="http://apt.alioth.debian.org/python-apt-doc/library/apt_pkg.html#apt_pkg.PackageManager" rel="noreferrer">PackageManager</a> class that has some methods to install a package. I tried some simple code to get this working:</p>
  
  <pre><code>apt_pkg.PackageManager.install("python")
  </code></pre>
  
  <p>This does not seem to work that easily, the install method expects apt_pkg.PackageManager instead of a plain String. Thus, looking a bit more, <a href="http://mancoosi.org/~abate/aptget-installation-plan" rel="noreferrer">I found this example</a> that looks promising, but I'm a bit reluctant to use since I don't really understand some of what is happening there. </p>
  
  <p>Then, has anyone tried to install a package using python-apt or should I go for using plain-old subopen style?</p>
  
  <p>Thanks!</p>