作者ilms49898723 (LittleBird)
看板C_and_CPP
標題Re: [問題] 'numpy/arrayobject.h' file not found
時間Tue Aug 13 08:54:07 2019
因為導致那個錯誤的檔案並不是同一個
只看這兩行:
#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
→ Philethan: 大大您好,想請問該怎麼知道Xcode compiler會找哪資料 08/13 16:32
→ Philethan: 夾。 08/13 16:32
推 Philethan: 感謝大大 我在想一下.. 08/13 16:35