You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Geopandas读取states.geojson时提示文件不存在的问题求助

Geopandas读取states.geojson时提示文件不存在的问题求助

各位好,

我按照教程尝试导入states.geojson文件时遇到了错误,我原本以为这个文件是geopandas预安装自带的。我当前使用的geopandas版本是0.14.4。

我的代码如下:

import geopandas as gpd
states = gpd.read_file('states.geojson') 

运行后出现的错误信息如下:

Traceback (most recent call last):

  File fiona/ogrext.pyx:130 in fiona.ogrext.gdal_open_vector

  File fiona/ogrext.pyx:134 in fiona.ogrext.gdal_open_vector

  File fiona/_err.pyx:375 in fiona._err.StackChecker.exc_wrap_pointer

CPLE_OpenFailedError: states.geojson: No such file or directory


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  Cell In[1], line 2
    states = gpd.read_file('states.geojson') # built in-file

  File ~/anaconda3/lib/python3.11/site-packages/geopandas/io/file.py:289 in _read_file
    return _read_file_fiona(

  File ~/anaconda3/lib/python3.11/site-packages/geopandas/io/file.py:315 in _read_file_fiona
    with reader(path_or_bytes, **kwargs) as features:

  File ~/anaconda3/lib/python3.11/site-packages/fiona/env.py:457 in wrapper
    return f(*args, **kwds)

  File ~/anaconda3/lib/python3.11/site-packages/fiona/__init__.py:342 in open
    colxn = Collection(

  File ~/anaconda3/lib/python3.11/site-packages/fiona/collection.py:226 in __init__
    self.session.start(self, **kwargs)

  File fiona/ogrext.pyx:876 in fiona.ogrext.Session.start

  File fiona/ogrext.pyx:136 in fiona.ogrext.gdal_open_vector

DriverError: Failed to open dataset (flags=68): states.geojson

希望大家能帮我看看这个问题怎么解决,谢谢!

备注:内容来源于stack exchange,提问作者Kernel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 16:32:58