[GRASS-dev] [GRASS GIS] #2333: choose python interpreter during the GRASS installation on windows

GRASS GIS trac at osgeo.org
Fri Jun 13 01:34:32 PDT 2014


#2333: choose python interpreter during the GRASS installation on windows
--------------------------------------------------+-------------------------
 Reporter:  zarch                                 |       Owner:  grass-dev@…              
     Type:  enhancement                           |      Status:  new                      
 Priority:  normal                                |   Milestone:  7.1.0                    
Component:  Python                                |     Version:  svn-trunk                
 Keywords:  windows installer python interpreter  |    Platform:  MSWindows 8              
      Cpu:  All                                   |  
--------------------------------------------------+-------------------------

Comment(by zarch):

 Replying to [comment:5 hellik]:
 > see my two comments above and change ''env.bat'' accordingly in L9 and
 L10.
 >
 > if that works, the option logic has to be added in the nsis-installer
 script.


 Thanks Helmut. Sorry for the delay, but I had to install all on my windows
 environment to be free to test, before I was using the computer of one of
 my colleagues... :-)

 ok, so I created a new bat file called: grass70svn_xy.bat that contains:

 {{{
 set GISBASE=C:\Users\PZambelli\Documents\GRASS GIS 7.0.0svn

 rem => add a environmental variable for pythonxy
 set PY_XY=C:\Python27

 rem => reading the env file for pxthonxy
 call "%GISBASE%\etc\env_xy.bat"

 cd "%USERPROFILE%"
 "%GRASS_PYTHON%" "%GISBASE%\etc\grass70.py" %*

 if %ERRORLEVEL% GEQ 1 pause
 }}}

 and in etc I added a new env_xy.bat file with:

 {{{
 set GRASS_SH=%GISBASE%\msys\bin\sh.exe

 set GRASS_HTML_BROWSER=chrome

 rem GRASS_PYTHON=%GISBASE%\extrabin\python.exe
 set GRASS_PYTHON=%PY_XY%\python.exe

 rem PYTHONHOME=%GISBASE%\Python27
 set PYTHONHOME=%PY_XY%

 set GRASS_PROJSHARE=%GISBASE%\share\proj

 set PROJ_LIB=%GISBASE%\share\proj
 set GDAL_DATA=%GISBASE%\share\gdal
 set GEOTIFF_CSV=%GISBASE%\share\epsg_csv

 set PATH=%GISBASE%\msys\bin;%PATH%
 set PATH=%GISBASE%\extrabin;%PATH%
 set PATH=%GISBASE%\bin;%PATH%
 }}}

 Then I open a cmd prompt, I move to the GISBASE directory and run:
 grass70svn_xy.bat...

 every is working without errors and the GUI is starting, from the GRASS
 cmd prompt I got:

 {{{
 GRASS 7.0.0svn> python -c "import sys; print(sys.executable)"
 c:\Users\PZambelli\Documents\GRASS GIS 7.0.0svn\extrabin\python.exe
 }}}

 and the same result from the GUI command console,

 But from the command prompt if I check the GRASS_PYTHON environment it
 seems to be set correctly:

 {{{
 GRASS 7.0.0svn> echo $GRASS_PYTHON$
 C:\Python27\python.exe$
 }}}

 But I got this error If I try to use the GRASS_PYTHON interpreter:


 {{{
 GRASS 7.0.0svn> $GRASS_PYTHON$
 sh.exe": C:\Python27\python.exe$: No such file or directory
 }}}

 Instead the GUI Python shell is using the pythonxy interpreter:

 {{{
 >>> import sys; sys.executable
 C:\Python27\python.exe
 }}}

 So it seemes to work, I guess...

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2333#comment:7>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list