我在我的 Windows 系统中创建了一个 python 环境。Python 版本是 3.6.6 我想安装 Fiona。尝试使用 pip 命令作为
pip install Fiona
但得到的错误为
Collecting Fiona
Using cached https://files.pythonhosted.org/packages/be/04/31d0a6f03943b1684f32c9b861be40c1fd282468fa6bd54ddf4a774e6b0f/Fiona-1.8.13.tar.gz
ERROR: Command errored out with exit status 1:
command: 'c:\users\User\myenv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-1dhz9c5u\\Fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-1dhz9c5u\\Fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\User\AppData\Local\Temp\pip-install-1dhz9c5u\Fiona\pip-egg-info'
cwd: C:\Users\User\AppData\Local\Temp\pip-install-1dhz9c5u\Fiona\
Complete output (1 lines):
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
这个也试过
pip install Fiona-1.8.13-cp36-cp36m-win_amd64.whl
这也给出了错误
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\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -Ic:\users\User\anaconda3\include -Ic:\users\User\anaconda3\include -Ic:\users\User\myenv\lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program 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.18362.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(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\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
---------------------------------------
-
ERROR: Failed building wheel for gdal
尝试安装 gdalpip install GDAL-2.4.1-cp36-cp36m-win_amd64.whl
并成功。但是 Fiona 安装仍然报错。
如何解决这个问题?