Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用未声明的标识符';NUMPY#u IMPORT#u ARRAY#RETVAL';返回NUMPY\u IMPORT\u ARRAY\u RETVAL;_Python_Pandas_Numpy - Fatal编程技术网

Python 使用未声明的标识符';NUMPY#u IMPORT#u ARRAY#RETVAL';返回NUMPY\u IMPORT\u ARRAY\u RETVAL;

Python 使用未声明的标识符';NUMPY#u IMPORT#u ARRAY#RETVAL';返回NUMPY\u IMPORT\u ARRAY\u RETVAL;,python,pandas,numpy,Python,Pandas,Numpy,未能安装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/anaconda

未能安装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.

gcc-Wno unused result-Wsign compare-wunrechable code-DNDEBUG-g-fwrapv-O3-Wall-Wstrict原型-I/Users//opt/anaconda3/envs/py38/include-arch x86_64-I/Users//opt anaconda3/envs/py38/include-arch x86_64-Ipandas/_libs/src/ujson/python-Ipandas/_libs/src/ujson-json-Ipandas/_libs/_libs/src/src/src/datetime-I/Users//opt/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include-I/Users//opt/anaconda3/envs/py38/include/python3.8-c pandas/_-libs/src/ujson/python/objToJSON.c-o-build/temp.macosx-10.9-x86-3.8/pandas/_-libs/src/src/ujson/python/objToJSON/objToJSON.o-D_GNU-SOURCE-Wno未使用的函数
在pandas/_libs/src/ujson/python/objToJSON.c:44中包含的文件中:
在/Users//opt/anaconda3/envs/py38/lib/python3.8/site packages/numpy/core/include/numpy/arrayobject.h中包含的文件中:4:
在/Users//opt/anaconda3/envs/py38/lib/python3.8/site packages/numpy/core/include/numpy/ndarrayobject.h中包含的文件中:12:
在/Users//opt/anaconda3/envs/py38/lib/python3.8/site packages/numpy/core/include/numpy/ndarraytypes.h:1822中包含的文件中:
/Users//opt/anaconda3/envs/py38/lib/python3.8/site packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2:warning:“使用不推荐的numpy api,请使用”“define npy_NO_deprecated__api_1_7_api_VERSION”[-W#警告]
#警告“使用不推荐的NumPy API,请使用禁用”\
^
pandas/_libs/src/ujson/python/objToJSON.c:194:12:错误:使用未声明的标识符“NUMPY\u IMPORT\u ARRAY\u RETVAL”
返回NUMPY\u IMPORT\u ARRAY\u RETVAL;
^
生成1个警告和1个错误。
错误:命令“gcc”失败,退出状态为1
----------------------------------------
大熊猫的回归
移动到/Users//opt/anaconda3/envs/py38/lib/python3.8/site-packages/pandas-1.0.3.dist-info/
来自/Users//opt/anaconda3/envs/py38/lib/python3.8/site packages/~andas-1.0.3.dist-info
移动到/Users//opt/anaconda3/envs/py38/lib/python3.8/site-packages/pandas/
来自/Users//opt/anaconda3/envs/py38/lib/python3.8/site packages/~andas
错误:命令出错,退出状态为1:/Users//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”__文件“''/private/var/folders/5p/_ydvdq5959v8p0kntv58swdc0000gn/T/pip-install-rnh260bm/pandas/setup.py'”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(compile(code,uuu file_uuu,“'exec'”)'install--record/private/var/folders/5p/ydvdq59v8p0kntv58swdc0000gn/T/pip-record-53ycqncw/install-record.txt--外部管理的单一版本--编译--安装头/Users//opt/anaconda3/envs/py38/include/python3.8/pandas检查日志以获得完整的命令输出。
复制 复制行为的步骤:

  • pip安装pysat
  • 设置:

    • OS:MacOS Catalina
    • 10.15.7(19H2)
    • Python:3.8
    • MacBook:MacBookPro(15英寸,2019年)
    附加上下文
    在这里添加关于这个问题的任何其他上下文。

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

    该错误的一个提示是,未使用名称声明变量:
    NUMPY\u IMPORT\u ARRAY\u RETVAL
    ;这包含对
    numpy
    的引用

    第一:您是否安装了
    numpy
    ?如果不是,我就从那里开始

    但是,在我的情况下,我不得不从1.19.5降到
    numpy
    。我无法告诉您在您的情况下必须使用
    numpy
    的方向,因为我不知道您在使用什么-但也许可以尝试修改
    numpy
    版本