当我尝试在运行 Python 3 的 Jupyter Notebook 中将地理数据框的几何图形从 EPSG4326 转换为 EPSG3857 时,我的内核一直在死机。
最小的可重现代码:
df = pd.DataFrame(
{'City': ['A', 'B', 'C', 'D', 'E'],
'Country': ['1', '2', '3', '4', '5'],
'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48],
'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86]})
crs = {'init': 'epsg:4326'}
gdf = gpd.GeoDataFrame(
df, crs=crs, geometry=gpd.points_from_xy(df.Longitude, df.Latitude))
gdf.geometry = gdf.geometry.to_crs(epsg=3857)
我已经在这个已关闭的 Github 问题中尝试了解决方案- 即更新到最新版本的 PyProj。这并不能解决我的问题。
我还尝试为 geopandas 创建一个新的、专用的 conda 环境。这也不能解决我的问题。
当我在 python 终端脚本中运行最小的可重现代码时,我得到以下输出,表明 Fiona 存在问题。
(geo) RichardgrimsMBP:desktop data_science$ python tocrs.py
Traceback (most recent call last):
File "tocrs.py", line 4, in
import geopandas as gpd
File "/opt/anaconda3/envs/geo/lib/python3.8/site-packages/geopandas/init.py", line 7, in
from geopandas.io.file import _read_file as read_file # noqa
File "/opt/anaconda3/envs/geo/lib/python3.8/site-packages/geopandas/io/file.py", line 7, in
import fiona
File "/opt/anaconda3/envs/geo/lib/python3.8/site-packages/fiona/init.py", line 86, in
from fiona.collection import BytesCollection, Collection
File "/opt/anaconda3/envs/geo/lib/python3.8/site-packages/fiona/collection.py", line 11, in
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: dlopen(/opt/anaconda3/envs/geo/lib/python3.8/site-packages/fiona/ogrext.cpython-38-darwin.so, 2): Symbol not found: _CCCryptorGCMFinalize
Referenced from: /opt/anaconda3/envs/geo/lib/libtiledb.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
in /opt/anaconda3/envs/geo/lib/libtiledb.dylib