[GRASS-user] Re: [GRASS-windows] WinGRASS Python 2.7

Glynn Clements glynn at gclements.plus.com
Tue Aug 30 15:35:30 EDT 2011


Johannes Radinger wrote:

> because I want to use some pythonscripts that only work (or can be
> installed) with Python 2.7, I'd like to couple my WinGRASS 6.4.1
> with my Python2.7 installation instead of the GRASS-Python.
> 
> So my Setup:
> * Windows 7
> * WinGRASS 6.4.1 (most recent)
> * Python 2.7
> 
> Following Environemtal Variables are set:
> * PATH includes C:\Python27
> * GRASS_PYTHON includes C:\Python27\python.exe
> * PYTHONPATH includes %GISBASE%\etc\python
> 
> 
> So my questions:
> 1) How can I check which Pyhton is in use by WinGrass?

The wx GUI uses GRASS_PYTHON. To check which version is being used:

1. Start the wx GUI
2. Bring up Windows' Task Manager
3. Switch to the Processes tab
4. Find the python.exe (or pythonw.exe) process in the list
5. Right click on the entry for the process
6. Choose "Open File Location" from the menu

Python scripts which are "executed" from a command prompt will use
whichever Python version is associated with the .py file extension.

Scripts which are executed from bash will use the script's "#!" line. 
If you use "#!/usr/bin/env python", it will use the first python.exe
in the path. You can check which version of Python is used by adding
e.g. "print sys.version" to the script.

> 2) Is there anything else I've to set?

Ensure that PYTHONHOME is /not/ set.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list