Building Python from Source on OpenSUSE
Posted on Sun 06 December 2015 in Computing
My very first post on this blog was how to build Python from source. In 2015 it turns out that this is a bit harder that it should be, and having wasted most of the morning working it out I'm posting the solution for future reference.
Building Python in the usual way (in this case Python 3.5)
./configure --prefix=/usr/local/python3.5 make sudo make altinstall
Installs a Python that is broken. e.g.
/usr/local/python3.5/bin/python3.5 -c "import random" ... ImportError: No module named 'math'
It turns out that Suse then installs some modules into /usr/local/python3.5/lib64/ which Python does not include in it's sys.path
This is a bit of a hack but the easiest way to fix this (for me) is to
sudo ln -s /usr/local/python3.5/lib64/python3.5/lib-dynload /usr/local/python3.5/lib/
This issue is well known it seems - Python bug reports