首页 > 解决方案 > 当我 pip 安装它时,pyproj 无法编译。这与 gcc 无关

问题描述

它会引发错误,使代码看起来确实有问题,例如:

 _proj.c:7486:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
     tstate->exc_type = local_type;
             ^~~~~~~~
             curexc_type
_proj.c:7487:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
     tstate->exc_value = local_value;
             ^~~~~~~~~
             curexc_value
_proj.c:7488:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
     tstate->exc_traceback = local_tb;

它是 pyproj 版本 1.9.5.1

标签: pythonpyproj

解决方案


这些文件由 Cython 生成。尝试将 Cython 升级到支持 Python 的版本并重新生成文件。(对于 Python 3.7,Cython >= 0.27.3)

编辑:

该线程建议通过指向 pyproj 的 git repo 来安装 pyproj。

pipenv install cython
pipenv install git+https://github.com/jswhit/pyproj.git#egg=pyproj

通过从 Git 安装,Cython 将重新编译必要的 c 文件。


推荐阅读