尝试安装caropy-python Anaconda时出错



我正试图在Anaconda安装中安装caropy,但它不起作用。以下是错误消息。如何安装此软件包?我尝试使用进行安装

pip install cartopy 

conda install -c conda-forge cartopy  

两者都会出现以下错误:

Building wheels for collected packages: cartopy
Building wheel for cartopy (PEP 517): started
Building wheel for cartopy (PEP 517): finished with status 'error'
Failed to build cartopy
ERROR: Command errored out with exit status 1:
command: 'C:Usersrubenanaconda3python.exe' 'C:Usersrubenanaconda3libsite- 
packagespip_vendorpep517in_process_in_process.py' build_wheel 'C
<string>:117: UserWarning: Unable to determine GEOS version. Ensure you have 3.7.2 or 
later installed, or installation may fail.
Fobuildtemp.win-amd64-cpython-39Releaselib/cartopy/trace.obj
trace.cpp
lib/cartopy/trace.cpp(719): fatal error C1083: Cannot open include file: 'geos_c.h': No 
such file or directory
error: command 'C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x64\cl.exe' failed 
with exit code 2
----------------------------------------
ERROR: Failed building wheel for cartopy
ERROR: Could not build wheels for cartopy which use PEP 517 and cannot be installed 
directly

Anaconda给了我这些错误:

conda install cartopy
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: |

现在它只是坐在那里旋转。

我安装了geos软件包。我不知道为什么它找不到安装。

这为我在Linux Mint系统中解决了这个问题。我可以看到OP的系统是Windows,所以不确定它是否也适用于他们。但对于在ubuntu/linux上登陆的用户来说,

我们需要先安装libgeos-dev:

sudo apt install libgeos-dev

从https://techoverflow.net/2021/08/13/6348/。

这似乎提供了上面提到的"geos_c.h"文件。

在这之后,pip install cartopy对我来说工作正常。

最新更新