2012-02-08

Installing Python3 on 64-bit platform: "Could not find platform dependent libraries"

The other day I did a vanilla Python v3.2.2 install on a 64-bit openSUSE 12.1. Installation went seemingly well, but when I started the interpreter shell, I was greeted with an error message:

Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:exec_prefix>]

The message may look different, depending, for example, on whether you have $PYTHONSTARTUP set to something meaningful. Playing with $PYTHONHOME didn't help. Very annoying.

It turned out, that on a 64-bit platform, by default, platform-independent libraries are installed in PREFIX/lib,and platform-dependent - in PREFIX/lib64. However, the interpreter remains unaware of PREFIX/lib64.

The fix is simple: use --libdir=[PATH] to force placement of both platform- dependent and independent libraries in the same directory that the interpreter can use:

./configure --prefix=[PATH] --libdir=[PATH]/lib

It doesn't seem important what you choose, lib, lib64.