pip install GDAL

1. Install GDAL with pip

1 Error description

Installing gdal directly using pip install gdal in the cmd window will report an error.

Cause of error: GDAL is not a pure python library, and the library file cannot be installed using methods such as pip install requests.

2 solutions

According to the python version, download the corresponding GDAL installation file.

GDAL official website: https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal .

After the download is complete, use the following command to complete the installation.

pip install GDAL-3.4.2-cp37-cp37m-win_amd64.whl

3 Verify installation

Open Python IDEL and enter the command:

from osgeo import gdal, osr, ogr

Press Enter to verify whether the installation was successful.

4 ImportError: numpy.core.multiarray failed to import solution

I also reported an error during the operation: ImportError: numpy.core.multiarray failed to import

In the command prompt window, execute the following command:

pip install -U numpy

success: 

2. Use GetGeoTransform(), gdal intercepts the image, and uses GDAL to convert image projection coordinates, geographic coordinates, and coordinates on the map

Study Notes—[python] GetGeoTransform() is used, gdal intercepts the image, and GDAL is used to convert image projection coordinates, geographic coordinates, and coordinates on the map

Guess you like

Origin blog.csdn.net/weixin_43570470/article/details/124650713