Hi,
I would like to use a different version of Python from the default install in the PC,
is there a way to force it in the configure script?
thx
Yann
Hi,
I would like to use a different version of Python from the default install in the PC,
is there a way to force it in the configure script?
thx
Yann
On Fri, Feb 20, 2015 at 1:47 PM, Yann Chemin <ychemin@gmail.com> wrote:
Hi,
I would like to use a different version of Python from the default install in the PC,
is there a way to force it in the configure script?
Not (yet) AFAIK. But you can modify it after the "configure" step here:
include/Make/Platform.make:PYTHON = python
There is at time the hardcoded name:
include/Make/Platform.make.in:PYTHON = python
Other option: use "alias":
[neteler@pgis_north ]$ python --version
Python 2.7.8
[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ python --version
Python 3.4.1
Then run "configure" etc. Of course the alias must then persist later,
so put it into $HOME/.bashrc or similar.
Markus
On 20/02/15 14:25, Markus Neteler wrote:
On Fri, Feb 20, 2015 at 1:47 PM, Yann Chemin <ychemin@gmail.com> wrote:
Hi,
I would like to use a different version of Python from the default install in the PC,
is there a way to force it in the configure script?Not (yet) AFAIK. But you can modify it after the "configure" step here:
include/Make/Platform.make:PYTHON = python
There is at time the hardcoded name:
include/Make/Platform.make.in:PYTHON = pythonOther option: use "alias":
[neteler@pgis_north ]$ python --version
Python 2.7.8[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ python --version
Python 3.4.1Then run "configure" etc. Of course the alias must then persist later,
so put it into $HOME/.bashrc or similar.
Doesn't 'export GRASS_PYTHON=YourChoiceOfPython' simply do the trick at runtime ?
Moritz
On Fri, Feb 20, 2015 at 8:25 AM, Markus Neteler <neteler@osgeo.org> wrote:
[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ python --version
Python 3.4.1
I thought alias works just for command line but the processes, e.g.
scripts, does not get them.
On Fri, Feb 20, 2015 at 2:51 PM, Vaclav Petras <wenzeslaus@gmail.com> wrote:
On Fri, Feb 20, 2015 at 8:25 AM, Markus Neteler <neteler@osgeo.org> wrote:
[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ python --version
Python 3.4.1I thought alias works just for command line but the processes, e.g. scripts,
does not get them.
Combined attempt:
[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ export GRASS_PYTHON=python3.4
[neteler@pgis_north ]$ grass71
Cleaning up temporary files...
Starting GRASS GIS...
...
GRASS 7.1.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHON
python3.4
GRASS 7.1.svn (nc_spm_08_grass7):~ > v.rast.stats
File "/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/forms.py",
line 2375
raise gcmd.GException, _("Unable to parse command '%s'") % ' '.join(cmd)
^
SyntaxError: invalid syntax
Did you refer to this problem, Vaclav?
Markus
On Fri, Feb 20, 2015 at 9:26 AM, Markus Neteler <neteler@osgeo.org> wrote:
On Fri, Feb 20, 2015 at 2:51 PM, Vaclav Petras <wenzeslaus@gmail.com>
wrote:
>
> On Fri, Feb 20, 2015 at 8:25 AM, Markus Neteler <neteler@osgeo.org>
wrote:
>>
>> [neteler@pgis_north ]$ alias python=python3.4
>>
>> [neteler@pgis_north ]$ python --version
>> Python 3.4.1
>
> I thought alias works just for command line but the processes, e.g.
scripts,
> does not get them.I refer to this:
$ echo "echo Hello." > test.sh
$ chmod u+x test.sh
$ alias echo='echo "MESSAGE: "'
$ echo Hello
MESSAGE: Hello
$ ./test.sh
Hello.
Combined attempt:
[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ export GRASS_PYTHON=python3.4
[neteler@pgis_north ]$ grass71
Cleaning up temporary files...
Starting GRASS GIS...
...GRASS 7.1.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHON
python3.4GRASS 7.1.svn (nc_spm_08_grass7):~ > v.rast.stats
File
"/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/forms.py",
line 2375
raise gcmd.GException, _("Unable to parse command '%s'") % '
'.join(cmd)
^
SyntaxError: invalid syntaxDid you refer to this problem, Vaclav?
No, but I guess that especially GUI is not Python 3 ready as well as
wxPython.
Vaclav
Markus
Yann Chemin wrote:
I would like to use a different version of Python from the default install in the PC,
is there a way to force it in the configure script?
No.
You can control the interpreter used for building by overriding the
PYTHON make variable, e.g.
make PYTHON=/path/to/python ...
For controlling the interpreter used at run time:
On Windows, Python scripts are invoked via %GRASS_PYTHON%, so changing
that environment variable will change the interpreter.
On Unix, GRASS_PYTHON is only used for components which use wxPython,
e.g. wxGUI or the parameter dialogs which are displayed when modules
are run without arguments.
Scripts rely upon the "#!/usr/bin/env python" line. You can control
the interpreter used by scripts by creating a directory containing a
symlink named "python" which refers to your preferred version of the
interpreter, and placing that directory at the front of $PATH.
--
Glynn Clements <glynn@gclements.plus.com>