1

I have Ubuntu 16.04 64 bit and python 2.7.12 on my system. I have installed GRASS GIS 7 from the Ubuntu software support (I thing not is the better choose for install).

Now I want to take GRASS Python API to run standalone Python scripts.

How can I install Python GRASS API(pygrass) to work in the Ubuntu, any idea?

On the Windows must be define paths and work, on LINUX I can't find any tutorial for that.


the script test

 import os
 import sys
 import subprocess
 grass70='/usr/lib/grass70'
 import grass.script as gscript

error :

no module name grass.script
nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Nov 29, 2016 at 17:07
2
  • Pygrass is integrated in GRASS GIS (Working with GRASS without starting it explicitly) Commented Nov 29, 2016 at 17:14
  • i cant to import pygrass packages on the python script to start writing code. Commented Nov 29, 2016 at 17:25

1 Answer 1

1

You can use Python/grass/PyGRASS from

1) the Python console of GRASS GIS

enter image description here

2) the shell of GRASS GIS

enter image description here

3) from outside, examples for Linux in Working with GRASS without starting it explicitly and Is it possible to use GRASS GIS in Python stand alone scripts?,and ...

answered Nov 29, 2016 at 17:45
5
  • i want to run outside in Linux but i dont know how to define paths to work with pygrass Commented Nov 29, 2016 at 17:58
  • In the reference, the script "Python: GRASS GIS 7 with existing location" explain the solution with Windows, Mac OS X and Linux Commented Nov 29, 2016 at 18:20
  • for the Linux say grass70 --config path /usr/local/grass-7.0.2svn.that all ?how to define this path on the Linux ?i am newbie in linux Commented Nov 29, 2016 at 18:29
  • for example i define path /usr/local/grass-7 in the python script but show me error no module name grass.script Commented Nov 29, 2016 at 18:44
  • Without your script, we can do nothing Commented Nov 29, 2016 at 18:52

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.