第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

構(gòu)建 Pybind11 - 測(cè)試用例不會(huì)運(yùn)行?

構(gòu)建 Pybind11 - 測(cè)試用例不會(huì)運(yùn)行?

當(dāng)年話下 2023-04-18 15:58:43
我目前正在嘗試在我的 Mac 上設(shè)置 Pybind。我遵循這些說(shuō)明:https://pybind11.readthedocs.io/en/stable/basics.html。我已經(jīng)在我的計(jì)算機(jī)上克隆了 pybind 存儲(chǔ)庫(kù),在該存儲(chǔ)庫(kù)中創(chuàng)建了構(gòu)建目錄,并運(yùn)行了測(cè)試用例 (make check -j 4)。這是我的目錄布局:Home/    ---example.cpp    ---pybind11/我有一個(gè)我寫的 example.cpp 文件:#include <pybind11/pybind11.h>namespace py = pybind11;int add (int i, int j) {        return i + j;}PYBIND11_MODULE(example, m) {        m.doc() = "pybind11 example plugin";        m.def("add", &add, "A function which adds two numbers");}example.cpp我使用以下命令和標(biāo)志編譯它(來(lái)源: https: //pybind11.readthedocs.io/en/stable/compiling.html#building-manually):c++ -O3 -Wall -shared -std=c++11 -undefined dynamic_lookup `python3 -m pybind11 --includes` example.cpp -o example`python3-config --extension-suffix`我收到以下錯(cuò)誤:example.cpp:1:10: fatal error: 'pybind11/pybind11.h' file not found#include <pybind11/pybind11.h>         ^~~~~~~~~~~~~~~~~~~~~1 error generated.當(dāng)我將文件移動(dòng)到 pybind11 存儲(chǔ)庫(kù)時(shí),我可以成功編譯,但執(zhí)行時(shí)會(huì)出現(xiàn)以下錯(cuò)誤:zsh: exec format error: ./example.cpython-37m-darwin.so任何幫助是極大的贊賞。跟進(jìn):我認(rèn)為 Seth 讓我更接近于讓它發(fā)揮作用(多謝),但我仍然遇到這個(gè)問(wèn)題:    c++ -O3 -Wall -shared -std=c++11 -undefined dynamic_lookup `python3 -m pybind11 --includes` example.cpp -o example`python3-config --extension-suffix` -I pybind11/include/ /Applications/Xcode.app/Contents/Developer/usr/bin/python3: No module named pybind11.__main__; 'pybind11' is a package and cannot be directly executedIn file included from example.cpp:1:In file included from pybind11/include/pybind11/pybind11.h:44:In file included from pybind11/include/pybind11/attr.h:13:In file included from pybind11/include/pybind11/cast.h:13:In file included from pybind11/include/pybind11/pytypes.h:12:pybind11/include/pybind11/detail/common.h:122:10: fatal error: 'Python.h' file not found#include <Python.h>     ^~~~~~~~~~1 error generated.嘗試在 github 上遵循這些人的建議,但我得到了同樣的錯(cuò)誤: https: //github.com/pybind/pybind11/issues/1728#issuecomment-616619910
查看完整描述

2 回答

?
qq_花開(kāi)花謝_0

TA貢獻(xiàn)1835條經(jīng)驗(yàn) 獲得超7個(gè)贊

文件 <pybind11/pybind11.h> 不在您的包含路徑中。您可以將它安裝到您機(jī)器的默認(rèn)包含路徑中,或者將 -I path_to_directory_containing_pybind11 添加到您的編譯命令中。



查看完整回答
1 反對(duì) 回復(fù) 2023-04-18
?
不負(fù)相思意

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超10個(gè)贊

問(wèn)題解決:c++ -O3 -Wall -shared -std=c++11 -undefined dynamic_lookup PYTHONPATH=./pybind11 python -m pybind11 --includesexample.cpp -o example`python3-config --extension-suffix

使用 makefile 也可以。


查看完整回答
反對(duì) 回復(fù) 2023-04-18
  • 2 回答
  • 0 關(guān)注
  • 480 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)