python各种包安装bug汇总

pip install pydensecrf

环境为python3.7.7+Ubuntu16.04,部分报错信息如下

ERROR: Command errored out with exit status 1:
pydensecrf/eigen.cpp: In function ‘void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
pydensecrf/eigen.cpp:17032:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
*type = tstate->exc_type;
^
{aka struct _ts}’ has no member named ‘exc_value’te
*value = tstate->exc_value;
^
pydensecrf/eigen.cpp:17034:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
*tb = tstate->exc_traceback;
^
pydensecrf/eigen.cpp: In function ‘void __Pyx__ExceptionReset(PyThreadState*, PyObject*, PyObject*, PyObject*)’:
pydensecrf/eigen.cpp:17041:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
tmp_type = tstate->exc_type;
^
pydensecrf/eigen.cpp:17042:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
tmp_value = tstate->exc_value;
^
pydensecrf/eigen.cpp:17043:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
tmp_tb = tstate->exc_traceback;
^
pydensecrf/eigen.cpp:17044:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
tstate->exc_type = type;
^
pydensecrf/eigen.cpp:17045:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
tstate->exc_value = value;
^
pydensecrf/eigen.cpp:17046:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
tstate->exc_traceback = tb;
^
pydensecrf/eigen.cpp: In functionint __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
pydensecrf/eigen.cpp:17101:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
tmp_type = tstate->exc_type;
^
pydensecrf/eigen.cpp:17102:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
tmp_value = tstate->exc_value;
^
pydensecrf/eigen.cpp:17103:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
tmp_tb = tstate->exc_traceback;
^
pydensecrf/eigen.cpp:17104:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
tstate->exc_type = local_type;
^
pydensecrf/eigen.cpp:17105:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
tstate->exc_value = local_value;
^
pydensecrf/eigen.cpp:17106:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
tstate->exc_traceback = local_tb;
^
pydensecrf/eigen.cpp: In function ‘void __Pyx__ExceptionSwap(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
pydensecrf/eigen.cpp:17128:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
tmp_type = tstate->exc_type;
^
pydensecrf/eigen.cpp:17129:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
tmp_value = tstate->exc_value;
^
pydensecrf/eigen.cpp:17130:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
tmp_tb = tstate->exc_traceback;
^
pydensecrf/eigen.cpp:17131:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
tstate->exc_type = *type;
^
pydensecrf/eigen.cpp:17132:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
tstate->exc_value = *value;
^
pydensecrf/eigen.cpp:17133:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
tstate->exc_traceback = *tb;
^

解决方案:

  1. 网上查找到的方案多为:该报错是因为未安装cython,因此使用pip install cython(本次报错实际已经安装cython,因此继续纠错)
  2. 据说用conda安装不会报错,即:conda install -c conda-forge pydensecrf(本次环境中未安装conda,不考虑此方案)
  3. 使用git直接安装最近版本,最终未报错,即:pip install git+https://github.com/lucasb-eyer/pydensecrf.git
原文地址:https://www.cnblogs.com/Xiaoyan-Li/p/14971984.html