Debianで標準のPythonを切り替えてpostgis/python-gdal周りでハマった

Debian Squeezeのpythonパッケージのデフォルトは2.6なのだけど、2.7をビルドして、/usr/bin/pythonを切り替えたりしていてハマった。
postgis/geodjangoを使えるようにしようとしたら、GDALのインストールでこけた。

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/local/include/python2.7 -I. -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-i686-2.7/extensions/gdal_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
extensions/gdal_wrap.cpp:2813:22: error: cpl_port.h: No such file or directory
extensions/gdal_wrap.cpp:2814:24: error: cpl_string.h: No such file or directory
extensions/gdal_wrap.cpp:2815:27: error: cpl_multiproc.h: No such file or directory
extensions/gdal_wrap.cpp:2817:18: error: gdal.h: No such file or directory
extensions/gdal_wrap.cpp:2818:23: error: gdal_priv.h: No such file or directory
extensions/gdal_wrap.cpp:2819:22: error: gdal_alg.h: No such file or directory
extensions/gdal_wrap.cpp:2820:24: error: gdalwarper.h: No such file or directory
extensions/gdal_wrap.cpp:2837: error: expected initializer before 'VeryQuietErrorHandler'
extensions/gdal_wrap.cpp:2713: warning: 'swig_module' defined but not used
error: command 'gcc' failed with exit status 1

や、

/usr/bin/ld: cannot find -lgdal
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1

など。postgisを中途半端にaptで入れたりしてるとバージョンを合わせたりしないといけなかったり、パスが通ってなかったりで、はまりやすいかも。
結局Pythonのバージョンをaptの2.6に戻して、python-gdal/geos/postgis周り全部aptitudeでインストールしてすんなり解決したという。
Debian++