0

I am using GDAL 2.0.3(installed through wheel) in Anaconda 4.2.0 with Python 3.5 installed.

I am able to import GDAL in my code. But whenever I am trying to run gdalinfo and other applications(such as gdalwarp,gdal_translate etc.) through Anaconda prompt, it gives an error:

gdalinfo is not recognised as an internal or external command

Whenever I change the path to the folder (where these applications are stored i.e. Anaconda3/Lib/site-packages/osgeo) and run gdalinfo, then it runs perfectly.

I need to set the environment variable through Environment variable settings but not able to correctly put together the syntax in the prompt.

0

I myself found a way out all we need to do is create a new environment variable i.e. System variable. First go to Control panel --> System and Security--> System--> Advanced System Settings--> Environment variables.

Now go the System variables and find a variable called Path in it. Just add a new path in this variable by giving the path of the gdal utility wherever it is stored. For Example.Mostly it will be stored in C:\User Profile name\Anaconda 3\Lib\site-packages\osgeo and click OK.(This path is just for exemplification original path may differ)

Enjoy all the utilities working through command line.

0

@Shubham_geo’s approach will work, but will set this environment variable either for all users or at least your user. If you work with multiple conda environments, each of which may have a different version of gdal, it may be a better idea to have these environment variables set when you activate your conda environment. That way it will not create conflicts for other users or environments that you may want to point to different versions of gdal.

See the conda documentation for more detail: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.