简体   繁体   English

使用 python 3.6.4 在 Windows 10 上安装 Gdal:致命错误 C1083:无法打开包含文件:'cpl_port.h'

[英]installing Gdal on Windows 10 with python 3.6.4: fatal error C1083: Cannot open include file: 'cpl_port.h'

So I am trying to pip install gdal but got an error.所以我正在尝试 pip 安装 gdal 但出现错误。

  extensions/gdal_wrap.cpp(3168): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

So I am running the following:所以我正在运行以下命令:

  • Python 3.6.4 anaconda distribution Python 3.6.4 anaconda 分布
  • Windows 10 (x64) Windows 10 (x64)
  • Microsoft Visual 2017 Redistribute both x64 and x86 (both installed by the vs builder tool) Microsoft Visual 2017 重新分发 x64 和 x86(均由 vs builder 工具安装)

MS Visual was installed because of this error before因为这个错误之前安装了 MS Visual

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

Here is the trace log for the error:这是错误的跟踪日志:

 C:\Users\0\Desktop\>pip install gdal
Collecting gdal
  Using cached GDAL-2.2.4.tar.gz
Building wheels for collected packages: gdal
  Running setup.py bdist_wheel for gdal ... error
  Complete output from command c:\users\0\envs\ecoscan\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\0\\AppData\\Local\\Temp\\pip-build-wc3za_f8\\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\0\AppData\Local\Temp\tmp9t7nk1ompip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  copying gdal.py -> build\lib.win-amd64-3.6
  copying ogr.py -> build\lib.win-amd64-3.6
  copying osr.py -> build\lib.win-amd64-3.6
  copying gdalconst.py -> build\lib.win-amd64-3.6
  copying gnm.py -> build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\osgeo
  copying osgeo\gdal.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\gdalconst.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\gdalnumeric.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\gdal_array.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\gnm.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\ogr.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\osr.py -> build\lib.win-amd64-3.6\osgeo
  copying osgeo\__init__.py -> build\lib.win-amd64-3.6\osgeo
  Fixing build\lib.win-amd64-3.6\gdal.py build\lib.win-amd64-3.6\ogr.py build\lib.win-amd64-3.6\osr.py build\lib.win-amd64-3.6\gdalconst.py build\lib.win-amd64-3.6\gnm.py build\lib.win-amd64-3.6\osgeo\gdal.py build\lib.win-amd64-3.6\osgeo\gdalconst.py build\lib.win-amd64-3.6\osgeo\gdalnumeric.py build\lib.win-amd64-3.6\osgeo\gdal_array.py build\lib.win-amd64-3.6\osgeo\gnm.py build\lib.win-amd64-3.6\osgeo\ogr.py build\lib.win-amd64-3.6\osgeo\osr.py build\lib.win-amd64-3.6\osgeo\__init__.py
  Skipping optional fixer: ws_comma
  Fixing build\lib.win-amd64-3.6\gdal.py build\lib.win-amd64-3.6\ogr.py build\lib.win-amd64-3.6\osr.py build\lib.win-amd64-3.6\gdalconst.py build\lib.win-amd64-3.6\gnm.py build\lib.win-amd64-3.6\osgeo\gdal.py build\lib.win-amd64-3.6\osgeo\gdalconst.py build\lib.win-amd64-3.6\osgeo\gdalnumeric.py build\lib.win-amd64-3.6\osgeo\gdal_array.py build\lib.win-amd64-3.6\osgeo\gnm.py build\lib.win-amd64-3.6\osgeo\ogr.py build\lib.win-amd64-3.6\osgeo\osr.py build\lib.win-amd64-3.6\osgeo\__init__.py
  Skipping optional fixer: ws_comma
  running build_ext
  building 'osgeo._gdal' extension
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\extensions
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\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\0\anaconda3\include -Ic:\users\0\anaconda3\include -I. "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /EHsc /Tpextensions/gdal_wrap.cpp /Fobuild\temp.win-amd64-3.6\Release\extensions/gdal_wrap.obj
  gdal_wrap.cpp
  extensions/gdal_wrap.cpp(3168): fatal error C1083: Cannot open include file: 'cpl_port.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

Any ideas how to fix this?任何想法如何解决这一问题? I just want use the ogr2ogr in gdal to convert.shp to GeoJSON then to topojson.我只想使用 gdal 中的ogr2ogr将.shp 转换为 GeoJSON,然后再转换为 topojson。

I had the same problem and found the solution here: gdal-installation-error-using-pip我遇到了同样的问题,并在这里找到了解决方案: gdal-installation-error-using-pip

That is: download the wheel file and install from the command line.即:下载wheel文件并从命令行安装。

I prefer use conda instead, I was stuck at the same issue for hours, this is the only solution to install GDAL I found.我更喜欢使用 conda,我被困在同一个问题上几个小时,这是我找到的安装 GDAL 的唯一解决方案。

conda install gdal康达安装gdal

暂无
暂无

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

相关问题 安装 pygrahviz 的问题“致命错误 C1083:无法打开包含文件:‘graphviz/cgraph.h’:没有此类文件或目录” - Issues installing pygrahviz "fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory" 无法在 Windows 上安装 lxml,致命错误 C1083:无法打开包含文件:'libxml/xmlversion.h' - Cannot install lxml on windows, fatal error C1083: Cannot open include file: 'libxml/xmlversion.h' 在 Windows x64 中运行 Cython - 致命错误 C1083:无法打开包含文件:'basetsd.h':没有这样的文件或目录 - Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory Could not install pycocotools in windows: fatal error C1083: Cannot open include file: 'io.h': No such file or directory 错误: - Could not install pycocotools in windows: fatal error C1083: Cannot open include file: 'io.h': No such file or directory error: Python pip install kivy致命错误C1083:无法打开包含文件:'GL / glew.h':没有这样的文件或目录 - Python pip install kivy fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory SWIG致命错误C1083:无法打开包含文件 - SWIG Fatal error C1083: Cannot open include file 编译Cython代码产生...致命错误C1083:无法打开包含文件:'io.h' - Compiling Cython code yields… fatal error C1083: Cannot open include file: 'io.h' 致命错误 C1083:无法打开包含文件:“basetsd.h” - fatal error C1083: Cannot open include file: 'basetsd.h' 致命错误C1083:无法打开包含文件:'openssl / opensslv.h':没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory 致命错误 C1083:无法打开包含文件:'dlfcn.h':没有这样的文件或目录 PyLPSolve - fatal error C1083: Cannot open include file: 'dlfcn.h': No such file or directory PyLPSolve
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM