In what module is shapefile defined

Issue

I want to run this example. It fails on the first line:

$ python3
>>> import shapefile
ModuleNotFoundError: No module named 'shapefile'

Apparently shapefile is not in the standard library. When I search in PyPi I get results, but in the first result no import shapefile is provided, so it’s unclear if this will work for me.

Am I missing something here, and should I just try all matches from the PyPi search without any reasoning? I’m a bit lost here…

Solution

I think the page you’re looking at is maybe out of date.

First run pip install pyshp on the command line. Then import shapefile in the Python prompt.

This works for me on Python 3.5.6.

https://pypi.org/project/pyshp/

Answered By – mm87

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published