简体   繁体   中英

How can i install gdal for python in windows 10?

I'm trying to install gdal library. i've tried the things recomended here Installing gdal python library on windows using conda (DLL load failed)

and here: 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM