title: Python installation, failing to find bz2 module
body: <p>OK, I have an old Debian VM. Package managers are useless. No, I'm not going to update the OS.</p>
  
  <p>I have the bzip2 lib and development headers installed correctly on my system (those actually came from a package).</p>
  
  <p>I start with absolutely NO Python on the system. I removed everything manually. I downloaded the Python 2.7.5 source, and configured with <code>./configure --prefix=/usr</code>. It configures fine. I run <code>make</code>, and it compiles fine. I try <code>./python -c "import bz2; print bz2.__doc__"</code>, it works, and says:</p>
  
  <blockquote>
    <p>The python bz2 module provides a comprehensive interface for
    the bz2 compression library. It implements a complete file
    interface, one shot (de)compression functions, and types for
    sequential (de)compression.</p>
  </blockquote>
  
  <p>I then run <code>make test</code> and the whole test suite progresses fine, and notably the "test_bz2" test passes.</p>
  
  <p>I then run <code>make install</code>, which installs my new Python binary into /usr/bin/ like I wanted.</p>
  
  <p>I try <code>/usr/bin/python -c "import bz2; print bz2.__doc__"</code>, and it fails with:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "", line 1, in 
    ImportError: No module named bz2</p>
  </blockquote>
  
  <p>I've tried a bunch of different things, including building Python as <code>--enable-shared</code> and not, no luck. I've tried at least 10 times (each time totally cleaning out everything, running <code>make distclean</code>, etc.). No luck.</p>
  
  <p>I tried: <code>PYTHONPATH="/usr/lib/python2.7"; export PYTHONPATH</code>. Still no luck.</p>
  
  <p>HOWEVER, if I delete the symlink that <code>make install</code> creates for /usr/bin/python, and instead do: <code>ln -s /path/to/my/python/compile/python python</code>, NOW it magically works.</p>
  
  <p>So, what the heck? Why is this Python binary I'm getting created only able to find stuff when the binary exists in the compile directory, and not when it's put into normal production install location? What am I missing?</p>
  
  <p>I am root during the entire process, from <code>configure</code> to <code>make</code> to <code>make install</code> to trying to test the Python import call.</p>
  
  <p>I have started from scratch again (this time compiling with <code>--enable-shared</code> btw), and verified that not only in the compile directory is there <code>build/lib.linux-x86_64-2.7/bz2.so</code>, but once I run <code>make install</code>, that file is put into <code>/usr/lib/python2.7/lib-dynload/bz2.so</code>.</p>
  
  <p>I've tried to do some reading on lib-dynload, but haven't been able to determine if there's something else a Python program (like default configuration for the CLI or whatever) would need to be able to tell it to pull module imports from lib-dynload, or if there's some other place or option to tell the <code>make install</code> where it should be putting it instead of dynload.</p>
  
  <p>Still I have no explanation why the <code>/path/to/compilation/python</code> binary can find and load <code>bz2.so</code> fine, but the <code>/usr/bin/python</code> binary can't find (or load) <code>/usr/lib/python2.7/lib-dynload/bz2.so</code>.</p>
  
  <p>I thought maybe it was something to do with the fact that the installation doesn't create like a <code>/usr/lib/python</code> symlink to point at <code>/usr/lib/python2.7</code> directory. But I created the symlink and still no go.</p>
  
  <p>I am still lost here.</p>