1

我正在尝试cartopy在 OS X 10.10 (Yosemite) 上安装。我的 python 是使用 macports 安装的,当我运行时:

sudo pip install cartopy

我收到以下错误:

/usr/bin/clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include -I./lib/cartopy -I/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c lib/cartopy/trace.cpp -o build/temp.macosx-10.10-x86_64-3.4/lib/cartopy/trace.o

lib/cartopy/trace.cpp:236:10: fatal error: 'geos_c.h' file not found

#include "geos_c.h"

         ^

1 error generated.

error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------
Command "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-hwrcv0a1/cartopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ytar95bq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hwrcv0a1/cartopy

请注意,我安装了此处所述的依赖项,geos_c.h可以在/opt/local/include. 似乎pip无法在macports树中找到这种依赖关系。

有没有人遇到过这种问题?我该如何解决?

这个问题也在https://github.com/SciTools/cartopy/issues/535作为问题提出。

4

2 回答 2

0

最近有一些工作来改善pip install cartopy体验。你介意用 cartopy v0.12.0 再试一次吗?

请参阅https://github.com/SciTools/cartopy/issues/610以供参考。

于 2015-05-06T16:08:12.350 回答
0

这是为了回答 Dror 的最后一个问题,因为我使用的是 macports 并且“pip install cartopy”找不到“proj_api.h”。要解决这个问题:

  1. 您需要确保已安装 proj 端口:sudo port install proj

  2. 帮助pip在“/opt/local/include”中定位header:CFLAGS="-I/opt/local/include" pip install cartopy

干杯和 HTH

于 2016-02-11T23:46:51.423 回答