I've really been trying to install Proj4 on my windows 10 laptop, and make it accessbile via my git bash command. According to Proj4's documentation, using OS4GeoW is the easiest way to install the dependency (https://proj4.org/install.html) on windows 10 computers so I ran the setup.exe file. I found additional instructions on proj4, however, that gave a command prompt instruction for installing proj4 from Os4Geo. The instruction was C:\Users\biney>osgeo4w-setup.exe --root C:\osgeo4w --quiet-mode --advanced --site http://download.osgeo.org/osgeo4w --packages proj (biney is my name). And since I ran this on my command prompt... I got a pretty big output. But everytime I try running "python" or "python3," I get an error message saying "Import Error: No Module named site.py"

I was looking at this question and it seemed like a potential resolution was to set the pythonpath and pythonhome environment variables OSgeo4W64 Windows 7 & ImportError: No Module Named Site

I've done that through this pc --> properties --> advanced settings --> environemntal variables, whatever graphical interface that is provided... But now when I run python commands, I get the following error message:

 File "C:\Users\biney\AppData\Local\Programs\Python\Python36-32\lib\site.py", line 177
 SyntaxError: invalid syntax

This is after adding the PYTHONHOME and PYTHONPATH environmental variables. The command python --version still comes back as python 2.7.4. For clarification, the original and correct version of python I've been using on my machine lives in this file location: C:\Users\biney\AppData\Local\Programs\Python\Python36-32

I figured out the version of python switched by running python --version. It returns as python 2.7.4, but I can't quite verify which directory holds the python 2.7.4 version. My guess would be in OSGeo4W, but I could be wrong. This would be the file location C:\OSGeo4W\apps\Python36 (because there's also a folder in the same directory called Python27, but it doesn't have a .exe file).

I'm really stuck. How could I figure out where exactly the python .exe file that's being ran is being run from? And what do I do about this new syntax error message?

  • You need to use the OSGeo4W command shell, not git bash shell. Or you can have a look at all the environment variables that the OSGeo4W command shell .bat file (and the .bat files that it runs) sets and replicate that in a bash shell script. – user2856 Jun 24 '18 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.