简体   繁体   English

如何在 Windows 10 中为 python 安装 gdal?

[英]How can i install gdal for python in windows 10?

I'm trying to install gdal library.我正在尝试安装 gdal 库。 i've tried the things recomended here Installing gdal python library on windows using conda (DLL load failed)我已经尝试过这里推荐的东西使用 conda 在 Windows 上安装 gdal python 库(DLL 加载失败)

and here: https://github.com/felipunky/GISPython/blob/master/README.md在这里: https : //github.com/felipunky/GISPython/blob/master/README.md

then i tried:然后我尝试:

C:\Users\User>pip install D:\Seba\Programas\GDAL-3.3.0-cp37-cp37m-win_amd64.whl
Requirement already satisfied: GDAL==3.3.0 from file:///D:/Seba/Programas/GDAL-3.3.0-cp37-cp37m-win_amd64.whl in c:\users\user\appdata\local\programs\python\python37\lib\site-packages (3.3.0)
WARNING: You are using pip version 20.1.1; however, version 21.1.2 is available.
You should consider upgrading via the 'c:\users\user\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.

C:\Users\User>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gdal'
>>> from osgeo import gdal
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\__init__.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: No se puede encontrar el módulo especificado.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\__init__.py", line 34, in <module>
    _gdal = swig_import_helper()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\osgeo\__init__.py", line 31, in swig_import_helper
    return importlib.import_module('_gdal')
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_gdal'
>>>

any recomendation?有什么建议吗?

Thanks谢谢

试试这个: sudo easy_install GDAL

conda install of gdal in windows does work.在 Windows 中 conda 安装 gdal 确实有效。

You haven't given much to go on, but my guess is that you have not activated the conda environment into which gdal has been installed.您没有做太多事情,但我的猜测是您还没有激活安装了 gdal 的 conda 环境。

Normally your command prompt would look like this, if you had activated it通常你的命令提示符看起来像这样,如果你已经激活它

(gdal_env_name) C:\Users\User>python

Also, run另外,运行

conda list

to check that all the expected libraries are there.检查所有预期的库是否都在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Windows 10 和 python 3.7 中使用 conda 安装 gdal? 安装geoviews后,我再也没有设法使用gdal - How to install gdal using conda in Windows 10 with python 3.7? After I installed geoviews I´ve never managed to use gdal again 尝试安装 GDAL - Python 3.9.9 - Pip - Windows 10 - Trying to install GDAL - Python 3.9.9 - Pip - Windows 10 如何在Windows 10上为python 3.6安装dlib? - How can I install dlib for python 3.6 on windows 10? 如何在Windows 10的“ Ubuntu Bash”上安装“ Python编辑器”? - How can I install “Python Editor” on “Ubuntu Bash” in Windows 10? 如何在 Windows 10 上安装 Python - How to install Python on Windows 10 我正在使用 python 3.9,但我不知道如何在我的 Windows 10 中安装 pyaudio - I am using python 3.9 and I can't figure out how to install pyaudio in my Windows 10 为什么我不能在 Windows 10 上使用 pip 安装 python 包? - Why can't I install python packages with pip on windows 10? 如何在 Windows 10 64 位上通过 Python Idle 3.8.6 安装 nltk 语料库? - How can I install nltk corpora through Python Idle 3.8.6 on windows 10 64 bit? 如何在 Windows 10 中使用 msiexec 安装 python 2.7.18 的两个实例? - How can I install two instances of python 2.7.18 with msiexec in Windows 10? 如何在Windows 10中为Python 3.6安装openbabel? - How do I install openbabel for Python 3.6 in Windows 10?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM