在pycharm windows10上安装GDAL的问题

问题描述 投票:0回答:1

当我在windows10上的pycharm中安装GDAL时出现了错误,我使用Python3.8。我使用Python3.8安装DjangoGeo,并尝试按照这个指南安装。https:/docs.djangoproject.comen3.0refcontribgistutorial。

感谢任何能解决我的问题的人,我是一个非常新的Python。我刚刚开始学习它的最后一年的项目。

(django-demo-2) C:\Users\CHANG WEI HONG\PycharmProjects\django-demo-2\demo2\world\data>pip install GDAL
Collecting GDAL
  Using cached GDAL-3.0.4.tar.gz (577 kB)
Building wheels for collected packages: GDAL
  Building wheel for GDAL (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJD\Scripts\python.exe' -u -c 'import s
ys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CHANG WEI HONG\\AppData\\Local\\Temp\\pip-install-n0
szrwth\\GDAL\\setup.py'"'"'; __file__='"'"'C:\\Users\\CHANG WEI HONG\\AppData\\Local\\Temp\\pip-install-n0sz
rwth\\GDAL\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\
n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\CHAN
G WEI HONG\AppData\Local\Temp\pip-wheel-ke5_j8pv'
       cwd: C:\Users\CHANG WEI HONG\AppData\Local\Temp\pip-install-n0szrwth\GDAL\
  Complete output (32 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win32-3.8
  copying gdal.py -> build\lib.win32-3.8
  copying ogr.py -> build\lib.win32-3.8
  copying osr.py -> build\lib.win32-3.8
  copying gdalconst.py -> build\lib.win32-3.8
  copying gdalnumeric.py -> build\lib.win32-3.8
  creating build\lib.win32-3.8\osgeo
  copying osgeo\gdal.py -> build\lib.win32-3.8\osgeo
  copying osgeo\gdalconst.py -> build\lib.win32-3.8\osgeo
  copying osgeo\gdalnumeric.py -> build\lib.win32-3.8\osgeo
  copying osgeo\gdal_array.py -> build\lib.win32-3.8\osgeo
  copying osgeo\gnm.py -> build\lib.win32-3.8\osgeo
  copying osgeo\ogr.py -> build\lib.win32-3.8\osgeo
  copying osgeo\osr.py -> build\lib.win32-3.8\osgeo
  copying osgeo\__init__.py -> build\lib.win32-3.8\osgeo
  Fixing build\lib.win32-3.8\gdal.py build\lib.win32-3.8\ogr.py build\lib.win32-3.8\osr.py build\lib.win32-3
.8\gdalconst.py build\lib.win32-3.8\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal.py build\lib.win32-3.8\osg
eo\gdalconst.py build\lib.win32-3.8\osgeo\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal_array.py build\lib.w
in32-3.8\osgeo\gnm.py build\lib.win32-3.8\osgeo\ogr.py build\lib.win32-3.8\osgeo\osr.py build\lib.win32-3.8\
osgeo\__init__.py
  Skipping optional fixer: ws_comma
  Fixing build\lib.win32-3.8\gdal.py build\lib.win32-3.8\ogr.py build\lib.win32-3.8\osr.py build\lib.win32-3
.8\gdalconst.py build\lib.win32-3.8\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal.py build\lib.win32-3.8\osg
eo\gdalconst.py build\lib.win32-3.8\osgeo\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal_array.py build\lib.w
in32-3.8\osgeo\gnm.py build\lib.win32-3.8\osgeo\ogr.py build\lib.win32-3.8\osgeo\osr.py build\lib.win32-3.8\
osgeo\__init__.py
  Skipping optional fixer: ws_comma
  running build_ext
  building 'osgeo._gdal' extension
  creating build\temp.win32-3.8
  creating build\temp.win32-3.8\Release
  creating build\temp.win32-3.8\Release\extensions
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\c
l.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/og
rsf_frmts -I../../gnm -I../../apps "-IC:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJD\include" "
-IC:\Users\CHANG WEI HONG\AppData\Local\Programs\Python\Python38-32\include" "-IC:\Users\CHANG WEI HONG\AppD
ata\Local\Programs\Python\Python38-32\include" "-IC:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJ
D\lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC
\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Progr
am Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\
10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.183
62.0\cppwinrt" /EHsc /Tpextensions/gdal_wrap.cpp /Fobuild\temp.win32-3.8\Release\extensions/gdal_wrap.obj
  gdal_wrap.cpp
  extensions/gdal_wrap.cpp(3173): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or
 directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25
.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for GDAL
  Running setup.py clean for GDAL
Failed to build GDAL
Installing collected packages: GDAL
    Running setup.py install for GDAL ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJD\Scripts\python.exe' -u -c 'import
 sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CHANG WEI HONG\\AppData\\Local\\Temp\\pip-install-
n0szrwth\\GDAL\\setup.py'"'"'; __file__='"'"'C:\\Users\\CHANG WEI HONG\\AppData\\Local\\Temp\\pip-install-n0
szrwth\\GDAL\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\
r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\
CHANG WEI HONG\AppData\Local\Temp\pip-record-94d1n8wv\install-record.txt' --single-version-externally-manage
d --compile --install-headers 'C:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJD\include\site\pyth
on3.8\GDAL'
         cwd: C:\Users\CHANG WEI HONG\AppData\Local\Temp\pip-install-n0szrwth\GDAL\
    Complete output (32 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.8
    copying gdal.py -> build\lib.win32-3.8
    copying ogr.py -> build\lib.win32-3.8
    copying osr.py -> build\lib.win32-3.8
    copying gdalconst.py -> build\lib.win32-3.8
    copying gdalnumeric.py -> build\lib.win32-3.8
    creating build\lib.win32-3.8\osgeo
    copying osgeo\gdal.py -> build\lib.win32-3.8\osgeo
    copying osgeo\gdalconst.py -> build\lib.win32-3.8\osgeo
    copying osgeo\gdalnumeric.py -> build\lib.win32-3.8\osgeo
    copying osgeo\gdal_array.py -> build\lib.win32-3.8\osgeo
    copying osgeo\gnm.py -> build\lib.win32-3.8\osgeo
    copying osgeo\ogr.py -> build\lib.win32-3.8\osgeo
    copying osgeo\osr.py -> build\lib.win32-3.8\osgeo
    copying osgeo\__init__.py -> build\lib.win32-3.8\osgeo
    Fixing build\lib.win32-3.8\gdal.py build\lib.win32-3.8\ogr.py build\lib.win32-3.8\osr.py build\lib.win32
-3.8\gdalconst.py build\lib.win32-3.8\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal.py build\lib.win32-3.8\o
sgeo\gdalconst.py build\lib.win32-3.8\osgeo\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal_array.py build\lib
.win32-3.8\osgeo\gnm.py build\lib.win32-3.8\osgeo\ogr.py build\lib.win32-3.8\osgeo\osr.py build\lib.win32-3.
8\osgeo\__init__.py
    Skipping optional fixer: ws_comma
    Fixing build\lib.win32-3.8\gdal.py build\lib.win32-3.8\ogr.py build\lib.win32-3.8\osr.py build\lib.win32
-3.8\gdalconst.py build\lib.win32-3.8\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal.py build\lib.win32-3.8\o
sgeo\gdalconst.py build\lib.win32-3.8\osgeo\gdalnumeric.py build\lib.win32-3.8\osgeo\gdal_array.py build\lib
.win32-3.8\osgeo\gnm.py build\lib.win32-3.8\osgeo\ogr.py build\lib.win32-3.8\osgeo\osr.py build\lib.win32-3.
8\osgeo\__init__.py
    Skipping optional fixer: ws_comma
    running build_ext
    building 'osgeo._gdal' extension
    creating build\temp.win32-3.8
    creating build\temp.win32-3.8\Release
    creating build\temp.win32-3.8\Release\extensions
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86
\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/
ogrsf_frmts -I../../gnm -I../../apps "-IC:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJD\include"
 "-IC:\Users\CHANG WEI HONG\AppData\Local\Programs\Python\Python38-32\include" "-IC:\Users\CHANG WEI HONG\Ap
pData\Local\Programs\Python\Python38-32\include" "-IC:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsv
bJD\lib\site-packages\numpy\core\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\
VC\Tools\MSVC\14.25.28610\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Pro
gram Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\includ
e\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program File
s (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.1
8362.0\cppwinrt" /EHsc /Tpextensions/gdal_wrap.cpp /Fobuild\temp.win32-3.8\Release\extensions/gdal_wrap.obj
    gdal_wrap.cpp
    extensions/gdal_wrap.cpp(3173): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file
or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.
25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\CHANG WEI HONG\.virtualenvs\django-demo-2-djNsvbJD\
Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CHANG WEI HONG\\A
ppData\\Local\\Temp\\pip-install-n0szrwth\\GDAL\\setup.py'"'"'; __file__='"'"'C:\\Users\\CHANG WEI HONG\\App
Data\\Local\\Temp\\pip-install-n0szrwth\\GDAL\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fil
e__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'
"'))' install --record 'C:\Users\CHANG WEI HONG\AppData\Local\Temp\pip-record-94d1n8wv\install-record.txt' -
-single-version-externally-managed --compile --install-headers 'C:\Users\CHANG WEI HONG\.virtualenvs\django-
demo-2-djNsvbJD\include\site\python3.8\GDAL' Check the logs for full command output.
python django installation pycharm gdal
1个回答
0
投票

在Windows上不能通过pip安装GDAL

作为指导 安装GeoDjango 建议你通过OSGeo4W来安装

OSGeo4W 安装程序帮助安装GeoDjango所需的PROJ.4、GDAL和GEOS库。

© www.soinside.com 2019 - 2024. All rights reserved.