[GRASS-dev] New attempt to update GRASS for Mac

Moritz Lennert mlennert at club.worldonline.be
Fri Jul 28 04:27:48 PDT 2017


On 28/07/17 06:19, Michael Barton wrote:
> Tried that and it seems to be ignored too. Here is the output from a 
> terminal in the shell (outside GRASS):
> 
> Last login: Thu Jul 27 22:04:37 on ttys001
> CMB-MacBook-Pro:~ cmbarton$ echo $GRASS_PYTHON
> /Applications/anaconda/bin/python
> 
> This should make anaconda python (2.7.13) the default.
> 
> But here is the output from a GRASS terminal:
> 
> GRASS 7.3.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHON
> python

How and where did you set GRASS_PYTHON ? I'm not an expert in MacOSX, 
but in GNU/Linux if I set 'export GRASS_PYTHON=SomeOtherPython' in one 
terminal, but launch GRASS in the second terminal, GRASS_PYTHON is not 
set at GRASS startup and is thus set to 'python' by default.


> GRASS 7.3.svn (nc_spm_08_grass7):~ > python
> Python 2.7.10 (default, Feb  7 2017, 00:08:15)
> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>  >>>
> 
> Also:
> 
> GRASS 7.3.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHONWX
> /usr/bin/pythonw2.7
> 
> This environmental variable is set inside GRASS somewhere. It does not 
> show up in the shell outside GRASS.
> 
> It GRASS ignoring the environmental variable setting for some reason. Is 
> there something hardwired in that insists on looking for Python in /usr/bin?

Launching the 'python' binary in the command line does not interact in 
any way with the GRASS_PYTHON variable. If you launch 'python', it will 
launch the first python executable found in PATH.

If you want to see if GRASS_PYTHON correctly runs the python you wanted, 
then run '$GRASS_PYTHON'.

For example:

export GRASS_PYTHON=/usr/bin/python3.6
GRASS 7.3.svn (ETRS89_LAEA):/data/home/mlennert > python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>>
GRASS 7.3.svn (ETRS89_LAEA):/data/home/mlennert > $GRASS_PYTHON
Python 3.6.2 (default, Jul 17 2017, 13:39:29)
[GCC 6.4.0 20170704] on linux
Type "help", "copyright", "credits" or "license" for more information.

There is a difference between calling 'python' from a command line in a 
terminal (even if the GRASS environnement variables are set, i.e. GRASS 
has been "started") and calling python using $GRASS_PYTHON as is done in 
the GRASS code.

Moritz


More information about the grass-dev mailing list