无法安装 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.
转载 重现行为的步骤:
设置:
附加上下文
在此处添加有关该问题的任何其他上下文。
最佳答案
我在不同的上下文和不同的架构(ubuntu)中遇到了类似的错误。
错误提示是变量未声明名称为:NUMPY_IMPORT_ARRAY_RETVAL
;这包含对 numpy
的引用.
第一:你有没有numpy
安装了吗?如果没有,我会从那里开始。
但是,就我而言,我不得不降级 numpy
从 1.19.5.我无法告诉你该往哪个方向走numpy
在你的情况下,因为我不知道你在做什么 - 但也许尝试修改 numpy
版本?
关于python - 使用未声明的标识符 'NUMPY_IMPORT_ARRAY_RETVAL' 返回 NUMPY_IMPORT_ARRAY_RETVAL;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64611523/