Installing ports for different versions of Python

Marcus von Appen mva at FreeBSD.org
Sun Oct 6 10:45:32 UTC 2013


On, Sat Oct 05, 2013, Daamn M wrote:

> Hi,
>
> Sorry if I'm asking a question that have been asked many times but I
> couldn't find an answer using google.
>
> I need to install few version of Python (at least 2.6, 2.7 and 3.3). I
> really appreciate that FreeBSD let me have many versions the same time. But
> I have a problem when I need some third party library. It turns out that I
> can have only one instance.
>
> For example: I have installed python 2.7 and then port py-someport. Then I
> installed python 3.3 and set PYTHON_DEFAULT_VERSION to point python 3.3. If
> I try to install port py-someport again I wll get an error message saying
> that an older version is already installed.

This is a limitation in package handling at the moment. The FreeBSD
ports tree unfortunately uses the origin (e.g. devel/py-someport) to
check, if a port was already installed, instead of e.g. the package name
(e.g. py33-someport, py27-someport, etc.).

This is something being out of scope of the FreeBSD python team, but we
hope for a change of that behaviour in the near future.

> The way a port is registered in the database suggest that there could be
> more than one version. I mean: port py-someport is registered as
> py27-someport when installed for python 2.7.
>
> Now I copy ports adding versio prefix. For example to install py-someport
> for version 3.3 I copy the port as py33-someport. I works pretty well but I
> don't find it a clean way.
>
> Could you help?

Your best chance at the moment would be to use virtualenv, if
possible. Most python packages feature pip support, so that you could

1) change to your specific virtualenv
2) pip install <python package>
   (or easy_install <python package>)
3) work in your virtualenv

Cheers
Marcus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-python/attachments/20131006/bc910e93/attachment.sig>


More information about the freebsd-python mailing list