如果需要,请将“spglib/spglib.h”的位置添加到此列表中。

如果需要,请将“spglib/spglib.h”的位置添加到此列表中。
syl2@syl2-HP-EliteBook-840-G2:~/Applications/thirdorder$ ./compile.sh
running build
running build_ext
building 'thirdorder_core' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/syl2/.local/lib/python3.8/site-packages/numpy/core/include -I/home/sy1/Applications/almabte-v1.3.2/build/external/spglib/src/spglib/python/ -I/usr/include/python3.8 -c thirdorder_core.c -o build/temp.linux-x86_64-3.8/thirdorder_core.o
In file included from /home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822,
                 from /home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/syl2/.local/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from thirdorder_core.c:557:
/home/syl2/.local/lib/python3.8/site-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]
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
thirdorder_core.c:559:10: fatal error: spglib/spglib.h: No such file or directory
  559 | #include "spglib/spglib.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

==============================================

我在以下目录中找到了 spglib.h,但不明白为什么它无法访问。

syl2@itel1530:~/Applications/thirdorder$ 查找 spglib.h

/home/syl2/.local/share/Trash/files/spglib.h /home/syl2/.local/share/Trash/info/spglib.h.trashinfo /home/syl2/Applications/almabte-v1.3.2/build/external/spglib/include/spglib/spglib.h /home/syl2/Applications/almabte-v1.3.2/build/external/spglib/src/spglib/src/spglib.h /home/syl2/Applications/spglib/src/spglib.h /home/syl2/Applications/thirdorder/spglib.h /snap/thirdorder/7/usr/local/include/spglib/spglib.h

答案1

感谢您的回复。我通过在setup.py文件中插入spglib目录解决了此错误。

================================================

如果需要,请将“spglib/spglib.h”的位置添加到此列表中。

例如:INCLUDE_DIRS=["/home/user/local/include"]

INCLUDE_DIRS = [“/snap/thirdorder/7/usr/local/include”] ... 。

相关内容