我不能用read_file的位势法。下面是代码和堆栈跟踪
import geopandas as gpd
path_to_data = gpd.datasets.get_path("nybb")
gdf = gpd.read_file(path_to_data)错误跟踪:
ImportError Traceback (most recent call last)
Input In [5], in <module>
1 path_to_data = gpd.datasets.get_path("nybb")
----> 2 gdf = gpd.read_file(path_to_data)
4 gdf
File ~/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/geopandas/io/file.py:166, in _read_file(filename, bbox, mask, rows, **kwargs)
104 def _read_file(filename, bbox=None, mask=None, rows=None, **kwargs):
105 """
106 Returns a GeoDataFrame from a file or URL.
107
(...)
164 by using the encoding keyword parameter, e.g. ``encoding='utf-8'``.
165 """
--> 166 _check_fiona("'read_file' function")
167 filename = _expand_user(filename)
169 if _is_url(filename):
File ~/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/geopandas/io/file.py:80, in _check_fiona(func)
78 def _check_fiona(func):
79 if fiona is None:
---> 80 raise ImportError(
81 f"the {func} requires the 'fiona' package, but it is not installed or does "
82 f"not import correctly.\nImporting fiona resulted in: {fiona_import_error}"
83 )
ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
Importing fiona resulted in: dlopen(/Users/junaid/Desktop/Udemy_projects/multiple/lib/python3.9/site-packages/fiona/ogrext.cpython-39-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/proj@7/lib/libproj.19.dylib
Referenced from: /opt/homebrew/Cellar/gdal/3.4.1_1/lib/libgdal.30.dylib
Reason: tried: '/opt/homebrew/opt/proj@7/lib/libproj.19.dylib' (no such file), '/usr/local/lib/libproj.19.dylib' (no such file), '/usr/lib/libproj.19.dylib' (no such file)看起来,地质公园是在引用一个古老版本的PROJ。我以前有proj7.2,但现在安装了8.2.1。
我还有以下版本的fiona和gdal fiona 1.8.19 GDAL 3.3.3
任何帮助都将不胜感激。
发布于 2022-02-18 18:46:54
您是否尝试过安装Fiona软件包?因为它需要从您的错误中获取此包。
https://stackoverflow.com/questions/71150460
复制相似问题