ImportError: No module named qgis.core ubuntu 16.04 python 2.7 qgis 2.16.2
<p>I keep getting this error in python from trying to call qgis from a script.</p>

<p>The code is:</p>

<pre><code>from qgis.core import *
from qgis.analysis import *
</code></pre>

<p>I have read every posting on SO about this;  wiped QGIS and reinstalled.  Reset my PYTHON_PATH and QGIS_PREFIX variables to the correct directory.  I've also checked the dependencies via <code>dpkg -l | grep qgis</code>and all of my dependencies are the xenial version.</p>

<p>Any other suggestions?</p>

<p>Finally got it working.  Had to completely wipe and reinstall QGIS twice and separately remove python-qgis.  Also had to uninstall anaconda.  After the second fresh install of QGIS I've gotten it working.</p>

<p>No other changes to my configuration.</p>

python ubuntu qgis