gpt4 book ai didi

python - Geopandas 读取文件

转载 作者:太空宇宙 更新时间:2023-11-04 05:42:37 27 4
gpt4 key购买 nike

我在使用 read_file 函数时遇到了一些关于 geopandas 和 fiona 的问题。这是我的回溯:

df = gpd.read_file('/Users/danqing0703/github/Land-Use-Simulation/LBS_Data_Fetching/osm_api/singapore_roads.geojson')

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-0c9777b3c6b2> in <module>()
----> 1 boros = GeoDataFrame.from_file('nybb.shp')

/Users/danqing0703/anaconda/lib/python2.7/site-packages/geopandas/geodataframe.pyc in from_file(cls, filename, **kwargs)
159
160 """
--> 161 return geopandas.io.file.read_file(filename, **kwargs)
162
163 @classmethod

/Users/danqing0703/anaconda/lib/python2.7/site-packages/geopandas/io/file.pyc in read_file(filename, **kwargs)
9 opening the file.
10 """
---> 11 import fiona
12 bbox = kwargs.pop('bbox', None)
13 with fiona.open(filename, **kwargs) as f:

/Users/danqing0703/anaconda/lib/python2.7/site-packages/fiona/__init__.py in <module>()
70 from six import string_types
71
---> 72 from fiona.collection import Collection, BytesCollection, vsi_path
73 from fiona._drivers import driver_count, GDALEnv, supported_drivers
74 from fiona.odict import OrderedDict

/Users/danqing0703/anaconda/lib/python2.7/site-packages/fiona/collection.py in <module>()
5 import sys
6
----> 7 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
8 from fiona.ogrext import Session, WritingSession
9 from fiona.ogrext import (

ImportError: dlopen(/Users/danqing0703/anaconda/lib/python2.7/site-packages/fiona/ogrext.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/lib/libgdal.1.dylib
Reason: Incompatible library version: libgdal.1.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0

最佳答案

更新系统的 libjpeg 破坏了 fiona 的动态链接。有两种方法可以解决这个问题:

我更喜欢:pip uninstall fiona, conda install fiona

如果你想坚持使用 pip:pip uninstall fionapip install fiona

更详细的解释,也可以看我的回答:

import matplotlib.pyplot gives ImportError: dlopen(…) Library not loaded libpng15.15.dylib

关于python - Geopandas 读取文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33338772/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com