11 Nov 2014 by dryobates
It’s easy to install multiple versions of Python with FreeBSD ports. Less obvious is how to install libraries for given Python version.
FreeBSD port collection is constructed in a way that we have:
- one main Python port lang/python, which installs default Python for given system
- ports for every main Python line (currently lang/python2 and lang/python3), which installs most up to date Python version in given line
- ports for every currently supported versions of Python ( lang/python27, lang/python32, lang/python33, lang/python34)
My system default python version is 2.7, but I need to test some of my python libraries in more version. So I simply installed all of them:
I can use all of them at the same time:
I had a problem with sqlite3:
With default Python version I can install it from "databases/py-sqlite3" doing "make install" like above. How to install it for Python3.x? There's no py34-sqlite3 port.
With python2.x I could install a replacement pysqlite through pip, but with python3.x that package is not supported any more:
The key is to set PYTHON_VERSION environment variable: