【问题标题】:Error when trying to install cartopy python Anaconda尝试安装 cartopy python Anaconda 时出错
【发布时间】:2022-09-28 14:49:03
【问题描述】:

我正在尝试在我的 Anaconda 安装中安装 cartopy,但它不起作用。以下是错误消息。我如何让这个包安装?我尝试使用安装

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:\\Users\\ruben\\anaconda3\\python.exe\' \'C:\\Users\\ruben\\anaconda3\\lib\\site- 
  packages\\pip\\_vendor\\pep517\\in_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.

Fobuild\\temp.win-amd64-cpython-39\\Release\\lib/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 包。不知道为什么找不到安装。

  • 你能显示你运行的命令吗?您使用了哪些渠道?

标签: python cartopy geos


【解决方案1】:

这在 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 为我正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-18
    • 1970-01-01
    • 1970-01-01
    • 2017-11-15
    • 1970-01-01
    • 2019-01-01
    • 1970-01-01
    相关资源
    最近更新 更多