Python ospybook library installation tutorial
Download the ospybook package
Link: https://www.manning.com/books/geoprocessing-with-python?a_bid=c3bae5be&a_aid=geopy
Click on Source Code in the lower left corner to download
Install the ospybook package
1. First decompress the downloaded osgeopy-code.zip, then decompress the ospybook-latest.zip inside, and find the setup.py file inside.
2. Open cmd and locate the setup.py folder (because The location where I store it is on the D drive, so here I take the D drive as an example)
First enterD:
Enter again cd D:\software\Pycharm\list\osgeopy-code\ospybook-latest\ospybook-1.0
and enter the path under setup.py in the D drive.
Enter command linepython setup.py build
After completion, enter the command line python setup.py install
to install
After successful installation, enter pip list
to view the installation list
Solution to error when running
After installation, you can import the library into pycharm import ospybook
for use, but an error occurred here:ModuleNotFoundError: No module named 'osgeo'
After this problem occurs, you can try to install the gdal library, but if you use it directly pip install gdal
, you will most likely get an error. Therefore, you need to download the corresponding GDAL installation file from the official website according to your python version.
Download address: https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
After downloading, enter in cmd pip install D:\software\Pycharm\list\GDAL-3.4.3-cp311-cp311-win_amd64.whl
to install gdal. After the installation is successful, import ospybook
there will be no problem when you run it again.