Re: [問題] 'numpy/arrayobject.h' file not found
因為導致那個錯誤的檔案並不是同一個
只看這兩行:
#include <Python.h>
#include <numpy/arrayobject.h>
(一)
Python.h在我的Case可以在/usr/include/python3.6/下找到,
因為Compiler通常都會找/usr/include,
所以你改成<Python/Python.h>可以Work
(我的case就要改成<python3.6/Python.h>)
(二)
但這樣編譯又跳出找不到Python.h,為什麼?
因為那個Python.h的問題不在你的code,
在ndarrayobject.h (arrayobject.h有include這個檔案),
很明顯的直接去改這個檔案是個很糟的做法,
所以我們就補上Python.h的位置資訊給他:
(路徑請參照自己的改)
Add: /usr/include/python3.6
Add: /path/to/numpy/installation/core/include
(三)
這樣就解釋為什麼你把include/去掉就找的到Python.h,
因為他找不到numpy/arrayobject.h,
自然不會有(二)
Compiler給的Message建議還是看完整不要只看結論XD
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 70.168.101.208 (美國)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1565657649.A.061.html
※ 編輯: ilms49898723 (70.168.101.208 美國), 08/13/2019 08:54:42
※ 編輯: ilms49898723 (70.168.101.208 美國), 08/13/2019 08:56:39
※ 編輯: ilms49898723 (70.168.101.208 美國), 08/13/2019 08:59:11
→
08/13 16:32,
4年前
, 1F
08/13 16:32, 1F
→
08/13 16:32,
4年前
, 2F
08/13 16:32, 2F
推
08/13 16:35,
4年前
, 3F
08/13 16:35, 3F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 4 篇):