gpt4 book ai didi

python - 如何修复 : collect2: error: ld returned 1 exit status error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

转载 作者:行者123 更新时间:2023-12-04 18:31:29 27 4
gpt4 key购买 nike

我试图安装一个 pygrib 包。在python 2中。
我安装了所有必需的软件包。 (https://jswhit.github.io/pygrib/docs/pygrib-module.html)
我命令 pip 安装 pygrib。但它有一个错误。
我在错误脚本中找不到错误。有很多警告。但我认为不安装没有问题。

如何解决此错误?

  ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-TKG3Ld --python-tag cp27
cwd: /tmp/pip-install-KuwhgZ/pygrib/
Complete output (38 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying ncepgrib2.py -> build/lib.linux-x86_64-2.7
running build_ext
skipping 'pygrib.c' Cython extension (up-to-date)
building 'pygrib' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -Ig2clib_src -I/usr/include/python2.7 -c pygrib.c -o build/temp.linux-x86_64-2.7/pygrib.o
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pygrib.c:613:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_16keys':
pygrib.c:13996:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_18_read_only_keys':
pygrib.c:14427:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_30tostring':
pygrib.c:18559:53: warning: passing argument 2 of 'grib_get_message' from incompatible pointer type [-Wincompatible-pointer-types]
__pyx_v_err = grib_get_message(__pyx_v_self->_gh, (&__pyx_v_message), (&__pyx_v_size));
^
In file included from pygrib.c:614:0:
/usr/include/grib_api.h:554:5: note: expected 'const void **' but argument is of type 'void **'
int grib_get_message(grib_handle* h ,const void** message, size_t *message_length);
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pygrib.o -leccodes -o build/lib.linux-x86_64-2.7/pygrib.so
/usr/bin/ld: cannot find -leccodes
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pygrib
Running setup.py clean for pygrib
Failed to build pygrib
Installing collected packages: pygrib
Running setup.py install for pygrib ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-NTYS3Y/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-KuwhgZ/pygrib/
Complete output (38 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying ncepgrib2.py -> build/lib.linux-x86_64-2.7
running build_ext
skipping 'pygrib.c' Cython extension (up-to-date)
building 'pygrib' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -Ig2clib_src -I/usr/include/python2.7 -c pygrib.c -o build/temp.linux-x86_64-2.7/pygrib.o
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pygrib.c:613:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_16keys':
pygrib.c:13996:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_18_read_only_keys':
pygrib.c:14427:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_30tostring':
pygrib.c:18559:53: warning: passing argument 2 of 'grib_get_message' from incompatible pointer type [-Wincompatible-pointer-types]
__pyx_v_err = grib_get_message(__pyx_v_self->_gh, (&__pyx_v_message), (&__pyx_v_size));
^
In file included from pygrib.c:614:0:
/usr/include/grib_api.h:554:5: note: expected 'const void **' but argument is of type 'void **'
int grib_get_message(grib_handle* h ,const void** message, size_t *message_length);
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pygrib.o -leccodes -o build/lib.linux-x86_64-2.7/pygrib.so
/usr/bin/ld: cannot find -leccodes
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-NTYS3Y/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

最佳答案

操作部分是cannot find -leccodes ,这意味着它找不到库 libeccodes.so
要安装它,你想做

sudo apt install libeccodes-dev

关于python - 如何修复 : collect2: error: ld returned 1 exit status error: command 'x86_64-linux-gnu-gcc' failed with exit status 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57308168/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com