Importerror:导入_gdal时DLL负载失败:找不到指定的模块
我有一个以前有效的python脚本,但现在引发了错误:Importerror:导入_gdal时DLL负载失败:找不到指定的模块。
我试图使用fiona上传shapefile,并最初是最初的消息读:Importerror:导入_fiona时的DLL负载失败:找不到指定的模块。
我在Windows 11上使用Anaconda Navigator作为我的IDE。
我知道这是一个已经具有的问题以前被问到,我已经阅读了这些问题的答案。但是,由于我的情况或我的误解和行动,这些解决方案都无法使用。因此,我的问题是我如何解决此问题,或者,如果不是那么简单,就可以更好地理解问题。
我已经在环境文件夹中使用的DLLS文件夹中,其中没有名称fiona,gdal或geopandas。
到目前为止,我的尝试是:
1。卸载并重新安装Fiona Gdal和Geopandas(我认为它们是依赖的)。
2。将所有库和Anaconda更新为最新景色。
3。下载可为Visual Studio 2015的Visual C ++重新分配。在下载过程中遇到了问题,因为它已经在我的计算机上安装了,这很可能是因为它是Windows计算机。如果我将其移至其他路径/文件夹,这可能会有所帮助吗?
4。在Cumputer上卸载并重新安装Anaconda Navigator。重新创建虚拟环境并导入必要的库。 结果:行中的错误:导入GPD
:Importerror:导入_datadir时DLL加载失败:找不到指定的模块。
如果有一个我没有提及的修复程序,或者您怀疑我尝试了上述固定的一个错误,因为我对如何存储Python库的理解有限,请提出建议!
谢谢
I have a python script that previously worked but that now throws the error:ImportError: DLL load failed while importing _gdal: The specified module could not be found.
I am trying to upload a shapefile using fiona and originally the message read: ImportError: DLL load failed while importing _fiona: The specified module could not be found.
I am using anaconda navigator as my IDE on windows 11.
I am aware that this is a question that has been asked before and I have read the answers to those questions. The solutions, however, hove not worked either due to my circumstance or my misinterpretation and action in following through with it. So my question is either how do I fix this, or, if it is not that simple, to better understand the problem.
I have looked inside the DLLs folder within the environment folder that I am using and there is nothing in there with name fiona, gdal or geopandas.
My attempts so far:
1. uninstall and re-install fiona gdal and geopandas (as I believe they are dependent).
2. update all libraries and anaconda to latest verions.
3. download Visual C++ Redistributable for Visual Studio 2015. Ran into issue during download as it was already installed on my computer, likely because it is a windows computer. Is it possible that this would help if i moved it to a different path/folder?
4. Uninstall and re-install anaconda navigator on cumputer. Re-create virtual environemt and import necessary libraries. result: error in line: import geopandas as gpd
: ImportError: DLL load failed while importing _datadir: The specified module could not be found.
If there is a fix that I have not mentioned or if you suspect that I attempted one of the above fixed incorrectly because of my limited understanding of how python libraries are stored please make a suggestion!
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在过去的几天里,我在同样的问题上苦苦挣扎。使用Conda,我尝试了我在Internet上发现的所有内容,例如:
Conda Update GDAL
conda update -n base -c defaults conda
创建新的环境(一遍又一遍地)。
尽管不建议您使用
pip install
...但没有结果尝试。最后,对我有用的是创建一个新的环境,使用Python版本3.6
conda create -n envy -end Python = 3.6 gdal spyder
让我知道它是否有效。
I was struggling badly with the same problem for the last couple of days. Using conda, I've tried everything I found on the internet such as:
conda update gdal
conda update -n base -c defaults conda
Creating new environments (over and over again).
Despite it's not recommended I even tried it with
pip install
... but no results.At the end what worked for me was to create a new environment with Python version 3.6
conda create -n env python=3.6 gdal spyder
Let me know if it worked.
conda install gdal = 3.0.2
此问题似乎是GDAL的新版本。 HM_FT将Python降级为3.6的技巧的原因是,它也导致GDAL降级为3.0.2版。
FWIW -GDAL版本3.4.1和3.5.2对我有这个问题。我不确定哪个中间版本(3.0.2和3.4.1之后)标志着出现此问题的点。
(添加信息)我已经在此问题上创建了一个GDAL问题报告: https://github.com /osgeo/gdal/essugy/6569
conda install gdal=3.0.2
This problem appears to be peculiar to newer versions of GDAL. The reason that HM_ft's trick of downgrading Python to version 3.6 worked was that it also caused GDAL to be downgraded to version 3.0.2.
FWIW - GDAL versions 3.4.1 and 3.5.2 have this issue for me. I am not sure of which intervening version (after 3.0.2 and up to 3.4.1) marks the point at which this problem appears.
(added info) I have created a GDAL problem report on this issue: https://github.com/OSGeo/gdal/issues/6569
尝试此顺序 -
源 - https://stackoverflow.com/a/58943939/1411191919
,请尝试
如果您希望 也安装rasterio
Try this sequence -
Source - https://stackoverflow.com/a/58943939/14111919
After this, try
if you wish to install rasterio also
我还收到
Importerror:导入_gdal时DLL负载失败:找不到指定的模块。
消息。但是,事实证明,问题不是GDAL DLL本身的缺乏,而是其依赖性之一。我通过安装 Visual Studio重新分布。错误消息是误导性的,或者至少令人困惑,因为“指定的模块”可能是指Python试图导入的库的依赖性。但是,歧义似乎不是Python实施的错,而是返回 API。
I was also receiving the
ImportError: DLL load failed while importing _gdal: The specified module could not be found.
message. However, it turns out that the problem was not the absence of the GDAL DLL itself, but the absence of one of its dependencies. I supplied this dependency by installing the Visual Studio redistributable.The error message is misleading, or at least confusing, in that it's not obvious that "the specified module" may refer to a dependency of the library that Python is trying to import. It seems that the ambiguity is not the fault of the Python implementation, however, but goes back to the Windows API.
当我尝试使用以下命令导入GDAL 3.4.3时,我收到了相同的错误消息:
我将GDAL 3.4.3安装到Windows 10上的新鲜Conda环境中。
通过Microsoft Visual C ++ 2015-2019的更新可以从14.28.29914重新分布到14.34.333130。 E_Cross的答案暗示了这个想法,他根本没有重新分配。
此外,在更新重新分布之后,我还将GDAL重新安装到了新的环境中。
I got the same error message when i tried to import gdal 3.4.3 with the following command:
I installed gdal 3.4.3 into a fresh conda environment on Windows 10.
The error could be resolved by an update of the Microsoft Visual C++ 2015-2019 Redistributable from 14.28.29914 to 14.34.33130. The idea was hinted by the answer from E_Cross who did not have the redistributable at all.
Also I reinstalled gdal into a new environment after the update of the redistributable.