[英]Having trouble including python.h file
抱歉這個愚蠢的問題,但我試圖測試一個 model,它說你可以用 python 3 運行它,但它是用 python 2 編寫的。訓練代碼有效,但測試代碼出錯。 到目前為止,我已經編輯了 python-config 文件,但是當我運行測試代碼時它給了我這個錯誤:
./include/pybind11/detail/common.h:112:10: fatal error: 'python3 / Python.h'
file not found
#include <python3 / Python.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
在 common.h 文件中,我在線閱讀,如果我想使用 python 3,我需要以這種方式編輯它:
#include <python3 / Python.h>
#include <python3 / frameobject.h>
#include <python3 / pythread.h>
很抱歉這個愚蠢的問題,但我無法用我的項目做到這一點。
您需要在環境變量中有一個包含 header 文件的 python3 文件夾。 然后 linker 應該可以工作並編譯。 但是:pybind應該如下:
#include <Python.h>
#include <frameobject.h>
#include <pythread.h>
您不包含任何更高級別的文件夾。
我希望這會有所幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.