Import error geopandas, fiona

这一生的挚爱 提交于 2021-01-27 16:36:03

问题


I have an error with import geopandas, fiona.

When I'm trying to import geopandas

import geopandas as gpd

It returns me

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-8-77a0d94ee2c6> in <module>()
      5 #ret = add(1,3)
      6 #print(ret)
----> 7 import geopandas as gpd

~\Anaconda3\lib\site-packages\geopandas\__init__.py in <module>()
      2 from geopandas.geodataframe import GeoDataFrame
      3 
----> 4 from geopandas.io.file import read_file
      5 from geopandas.io.sql import read_postgis
      6 from geopandas.tools import sjoin

~\Anaconda3\lib\site-packages\geopandas\io\file.py in <module>()
      1 import os
      2 
----> 3 import fiona
      4 import numpy as np
      5 import six

~\Anaconda3\lib\site-packages\fiona\__init__.py in <module>()
     67 from six import string_types
     68 
---> 69 from fiona.collection import Collection, BytesCollection, vsi_path
     70 from fiona._drivers import driver_count, GDALEnv
     71 from fiona.drvsupport import supported_drivers

~\Anaconda3\lib\site-packages\fiona\collection.py in <module>()
      7 
      8 from fiona import compat
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
     10 from fiona.ogrext import Session, WritingSession
     11 from fiona.ogrext import (

ImportError: DLL load failed: The specified module could not be found.

I used "conda install -c conda-forge geopandas" and found that geopandas is installed on C:\Users\Kim\Anaconda3(by "conda list" in anaconda prompt ). But when I typed

import sys
'geopandas' in sys.modules

It has returned me "False"

I thought reinstalling anaconda could help me but it wasn't.

Is anyone has solved this problem?

FYI, I'm using windows 10 64bit


回答1:


I had same problem and following commands help me.

First of all I added conda channels (last channel has highest priority).

conda config --add channels conda-forge
conda config --add channels anaconda

Then try to create new environment using conda.

conda create -n geoPython3 python=3.6 geopandas=0.4.0 gdal=2.2.4

Let me know if it helps.



来源:https://stackoverflow.com/questions/51807423/import-error-geopandas-fiona

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!