How to enforce a particular Python version during port build

Blair Zajac blair at orcaware.com
Sat Aug 31 23:39:53 UTC 2019


You’ll want to avoid the PATH approach as it requires that ${prefix}/bin/python be symlinked to a Python 3.x, which isn’t always the case. I have ${prefix}/bin/python symlinked to Python 2.7.

Instead tell it to use ${prefix}/bin/python3.7. You’ll have to poke into the project to see how to tell it specifically which Python binary to use.

Blair

> On Aug 31, 2019, at 4:15 PM, Ralph Seichter <abbot at monksofcool.net> wrote:
> 
> I am wrestling with a port that requires Python >=3.5 to build, and
> Python 3.7 is the chosen one:
> 
>  $ which python
>  /opt/local/bin/python
>  $ python --version
>  Python 3.7.4
> 
> Looks good to me. However, the build log shows the following:
> 
>  :info:build Python 3.5 or greater required, but you have Python 2.7.16
> 
> Seems like Apple's Python 2.7 is being used. I have already tried adding
> 'build.env PATH=/opt/local/bin:$env(PATH)' to the Portfile, but this did
> not resolve the issue. What am I missing?
> 
> -Ralph
> 



More information about the macports-dev mailing list