Solved lxml and python3

The port simply uses whatever is set as the default, and the default is set to Python 2.7.

Add this to /etc/make.conf:
Code:
DEFAULT_VERSIONS+= python=3.4
After that devel/py-lxml should build against Python 3.

Note that this may cause problems with other Python ports. Not everything may be compatible.
 
OK, many thanks! As I don't want to run into other problems on my FreeBSD box, I have found another workaround (I use xmllint through a subprocess.Popen()). But at some point, I guess Python 3 will become the default, then I will certainly switch to lxml.
 
Use pip3 install lxml to get lxml for Python 3 today. You might need to run python3 -m ensurepip first to get pip3.

If you're worried about installing this system-wide you can run pip3 install --user lxml and python3 -m ensurepip --user instead to install them for your user only. pip3 while be installed to ~/.local/bin in that case, so add it to your PATH.
 
Back
Top