安装Cartopy时遇到麻烦-用于工作

问题描述 投票:0回答:1

我以前在我的MAC上安装了Cartopy。当我执行“ pip3 install metpy”时,它被metpy拖入了。我最近不得不重新安装,而metpy并未将其拖入其中。现在安装cartopy时出现错误:

> pip3 install cartopy
Collecting cartopy
  Using cached Cartopy-0.17.0.tar.gz (8.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Processing /Users/lroot/Library/Caches/pip/wheels/a6/0c/de/321b5192ad416b328975a2f0385f72c64db4656501eba7cc1a/pyshp-2.1.0-cp37-none-any.whl
Collecting shapely>=1.5.6
  Using cached Shapely-1.7.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.6 MB)
Requirement already satisfied: six>=1.3.0 in /usr/local/lib/python3.7/site-packages (from cartopy) (1.14.0)
Requirement already satisfied: numpy>=1.10 in /usr/local/lib/python3.7/site-packages (from cartopy) (1.18.1)
Requirement already satisfied: setuptools>=0.7.2 in /Users/lroot/Library/Python/3.7/lib/python/site-packages (from cartopy) (45.0.0)
Building wheels for collected packages: cartopy
  Building wheel for cartopy (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpnpafqiiy
       cwd: /private/tmp/pip-install-0phmeb7k/cartopy
  Complete output (270 lines):

跟踪的相关结尾是:

   In file included from lib/cartopy/trace.cpp:614:
  /usr/local/Cellar/proj/7.0.0/include/proj_api.h:37:2: error: 'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'
  #error 'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'
   ^
  In file included from lib/cartopy/trace.cpp:615:
  In file included from ./lib/cartopy/_trace.h:27:
  /usr/local/Cellar/proj/7.0.0/include/proj_api.h:37:2: error: 'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'
  #error 'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'
   ^
  2 errors generated.
  /private/tmp/pip-build-env-jk86sm4x/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/tmp/pip-install-0phmeb7k/cartopy/lib/cartopy/trace.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  /private/tmp/pip-build-env-jk86sm4x/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/tmp/pip-install-0phmeb7k/cartopy/lib/cartopy/_crs.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)
  warning: lib/cartopy/_crs.pyx:39:4: 'projPJ' redeclared
  /private/tmp/pip-build-env-jk86sm4x/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/tmp/pip-install-0phmeb7k/cartopy/lib/cartopy/geodesic/_geodesic.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for cartopy
Failed to build cartopy
ERROR: Could not build wheels for cartopy which use PEP 517 and cannot be installed directly

Proj 7.0是brew将安装的最新版本。为什么不推荐使用?为什么Cartopy使用不推荐使用的库?

python-3.x pip macos-catalina cartopy
1个回答
0
投票

这是一种解决方法

https://github.com/SciTools/cartopy/issues/1288

将项目降级到5.2.0。

© www.soinside.com 2019 - 2024. All rights reserved.