[英]Geodjango Import Shapefile with LayerMapping and OGR
[英]How to import shapefile
我已經在命令提示符下安裝了 pyshp 包
pip install pyshp
它是成功的(“要求已經滿足”)。
但是我在將 shapefile 導入 Jupyter Notebook 時遇到問題
import shapefile as sh
這給出了錯誤: ModuleNotFoundError: No module named 'shapefile'
我錯過了什么?
用康達魔法
正如@Wayne 所建議的,您可以使用內置的 ipython 魔術命令:
%pip install pyshp
import shapefile as sh
更多信息在這里: 內置魔術命令
老辦法
在你的 Jupyter 筆記本中,寫下:
import sys
!{sys.executable} -m pip install pyshp
import shapefile as sh
在本地安裝包和將其安裝到 Jupyter 內核中是兩件不同的事情。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.