【问题标题】:use of undeclared identifier 'NUMPY_IMPORT_ARRAY_RETVAL' return NUMPY_IMPORT_ARRAY_RETVAL;使用未声明的标识符“NUMPY_IMPORT_ARRAY_RETVAL”返回 NUMPY_IMPORT_ARRAY_RETVAL;
【发布时间】:2021-01-18 05:56:46
【问题描述】:

安装 pysat 失败并收到一条长长的错误消息,如下所示。

错误信息:


    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/<home>/opt/anaconda3/envs/py38/include -arch x86_64 -I/Users/<home>/opt/anaconda3/envs/py38/include -arch x86_64 -Ipandas/_libs/src/ujson/python -Ipandas/_libs/src/ujson/lib -Ipandas/_libs/src/datetime -I/Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include -I/Users/<home>/opt/anaconda3/envs/py38/include/python3.8 -c pandas/_libs/src/ujson/python/objToJSON.c -o build/temp.macosx-10.9-x86_64-3.8/pandas/_libs/src/ujson/python/objToJSON.o -D_GNU_SOURCE -Wno-unused-function
    In file included from pandas/_libs/src/ujson/python/objToJSON.c:44:
    In file included from /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4:
    In file included from /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
    In file included from /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:
    /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it with " \
     ^
    pandas/_libs/src/ujson/python/objToJSON.c:194:12: error: use of undeclared identifier 'NUMPY_IMPORT_ARRAY_RETVAL'
        return NUMPY_IMPORT_ARRAY_RETVAL;
               ^
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
  Rolling back uninstall of pandas
  Moving to /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pandas-1.0.3.dist-info/
   from /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/~andas-1.0.3.dist-info
  Moving to /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pandas/
   from /Users/<home>/opt/anaconda3/envs/py38/lib/python3.8/site-packages/~andas
ERROR: Command errored out with exit status 1: /Users/<home>/opt/anaconda3/envs/py38/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5p/_ydvdq5959v8p0kntv58swdc0000gn/T/pip-install-rnh260bm/pandas/setup.py'"'"'; __file__='"'"'/private/var/folders/5p/_ydvdq5959v8p0kntv58swdc0000gn/T/pip-install-rnh260bm/pandas/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5p/_ydvdq5959v8p0kntv58swdc0000gn/T/pip-record-53ycqncw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/<home>/opt/anaconda3/envs/py38/include/python3.8/pandas Check the logs for full command output.

复制 重现行为的步骤:

  1. pip install pysat

设置:

  • 操作系统:MacOS Catalina
  • 10.15.7 (19H2)
  • Python:3.8
  • MacBook:MacBook Pro(15 英寸,2019 年)

附加上下文 在此处添加有关该问题的任何其他上下文。

【问题讨论】:

    标签: python pandas numpy


    【解决方案1】:

    我在不同的上下文和不同的架构 (ubuntu) 中遇到了类似的错误。

    错误提示是未声明变量的名称为:NUMPY_IMPORT_ARRAY_RETVAL;这包含对numpy 的引用。

    第一:你安装了numpy 吗?如果没有,我会从那里开始。

    但是,就我而言,我不得不将 numpy 从 1.19.5 降级。我无法告诉你在你的情况下你必须使用numpy 的方向,因为我不知道你在做什么 - 但也许尝试修改numpy 版本?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多