Some improvement for detecting Python module path.

Change is part of getting MacPorts working.
Merge branch 'garth/python-lib-path'