1. 程式人生 > 其它 >python各種包安裝bug彙總

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