本文介绍了Fiona python中的导入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用whl发行版安装了fiona ..但是在导入时出现以下错误:

i have installed fiona using whl distributions.. but while importing i am getting following error :

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-b0161244e1be> in <module>()
----> 1 import fiona
      2 with fiona.open(r'C:\Users\harish.padi\Downloads\BSP\BSP\BSP_default_pred.shp', 'r') as input:
      3     with open(r'C:\Users\harish.padi\Downloads\BSP\BSP\output.txt', 'w') as output:
      4        for pt in input:
      5            id = pt['properties']['id']

c:\program files\python36\lib\site-packages\fiona\__init__.py in <module>()
     75     pass
     76
---> 77 from fiona.collection import Collection, BytesCollection, vsi_path
     78 from fiona._drivers import driver_count, GDALEnv
     79 from fiona.drvsupport import supported_drivers

c:\program files\python36\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.

有人可以提出解决方案吗?

can anyone suggest a solution.?

推荐答案

当我安装fiona并尝试导入它时,我也遇到了一些麻烦.我收到了这样的消息

I had also some troubles when i installed fiona and tried to import it. I had this kind of message

>>> import fiona
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Software\Ingenieria\Anaconda2\lib\site-packages\fiona\__init__.py", l
ine 77, in <module>
    from fiona.collection import Collection, BytesCollection, vsi_path
  File "D:\Software\Ingenieria\Anaconda2\lib\site-packages\fiona\collection.py",
 line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed: The specified module could not be found.

最后它对我有什么作用?

How did it work for me at the end?

  • 我通过链接安装了GDAL 2.2.4和Fiona发行版
  • 然后,我检查我的计算机是否具有适用于python的c ++编译器(此处链接有关您可能需要安装的信息).在某些论坛问题中,我读到GDAL需要此编译器才能工作.
  • 然后,我将Osgeo文件夹路径(有fiona的dll)添加到我的路径环境变量中,这是我PC上的一些图片打印屏幕2 打印屏幕2
  • I installed the distributions GDAL 2.2.4 and Fiona from this link
  • Then i checked if my computer has a c++ compiler for python (here link with some information about which one you may need to install). In some forum questions i read that GDAL need this compiler to be able to work.
  • Then i added the Osgeo folder path (there are the dlls for fiona) to my path environment variable, some pics from my pc Print screen 1 Print screen 2

执行完这些步骤后,fiona不再存在任何问题.最初,我使用的是GDAL 1.1.4版,但从未与该版本一起使用.您可以先尝试使用版本1,如果它不起作用,则安装版本2.2.4

After doing those steps i never had any more problems with fiona. At first, i was using the GDAL version 1.1.4 but it never worked with this one. You can try first with the version one, and if it doesn´t work then install the version 2.2.4

这篇关于Fiona python中的导入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 02:47