使用 Anaconda 安装 GDAL
Installing GDAL with Anaconda
我刚刚全新安装了 Anaconda3,正在尝试添加 GDAL/OGR。我已经尝试使用 conda install gdal
和 conda install -c conda-forge gdal
进行安装。在这两种情况下,安装都成功完成,但是当我导入 gdal 时,它会引发错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\site-packages\osgeo\__init__.py", line 25, in <module>
_gdal = swig_import_helper()
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\site-packages\osgeo\__init__.py", line 21, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
我觉得跟这个错误有关https://github.com/conda-forge/gdal-feedstock/issues/219
你应该使用虚拟环境,(至少为了快速测试不同的配置)
您可以尝试以下修复方法之一:
1)
从问题来看,vs2015_runtime 似乎有问题,它必须是 14 才能工作。所以检查你的vc2015运行时版本,如果太高可以降级。
conda create --name gdal_vs15_14 python=3.6.5
(在这里您可能可以看到它安装到环境中的 vs2015_runtime 版本)
conda activate gdal_vs15_14
conda install -c conda-forge vs2015_runtime=14
conda install -c conda-forge gdal
2)
目前另一个简单的修复方法是使用 python 2.7(这当然不是最优的,但至少对我来说是一个快速修复)
conda create --name gdal_py27 python=2.7
conda activate gdal_py27
conda install -c conda-forge gdal
我刚刚全新安装了 Anaconda3,正在尝试添加 GDAL/OGR。我已经尝试使用 conda install gdal
和 conda install -c conda-forge gdal
进行安装。在这两种情况下,安装都成功完成,但是当我导入 gdal 时,它会引发错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\site-packages\osgeo\__init__.py", line 25, in <module>
_gdal = swig_import_helper()
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\site-packages\osgeo\__init__.py", line 21, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\user\AppData\Local\Continuum\miniconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
我觉得跟这个错误有关https://github.com/conda-forge/gdal-feedstock/issues/219
你应该使用虚拟环境,(至少为了快速测试不同的配置)
您可以尝试以下修复方法之一:
1)
从问题来看,vs2015_runtime 似乎有问题,它必须是 14 才能工作。所以检查你的vc2015运行时版本,如果太高可以降级。
conda create --name gdal_vs15_14 python=3.6.5
(在这里您可能可以看到它安装到环境中的 vs2015_runtime 版本)
conda activate gdal_vs15_14
conda install -c conda-forge vs2015_runtime=14
conda install -c conda-forge gdal
2)
目前另一个简单的修复方法是使用 python 2.7(这当然不是最优的,但至少对我来说是一个快速修复)
conda create --name gdal_py27 python=2.7
conda activate gdal_py27
conda install -c conda-forge gdal