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: