![](/img/trans.png)
[英]Boost-Python: Expose a class to Python which is a subclass of a Python class (str)
I am trying to have a Boost Python function return a Python class which is a subclass of a Python builtin class (here str ): 我的第一種方法涉及在 Python 模塊 mys ...
[英]Boost-Python: Expose a class to Python which is a subclass of a Python class (str)
I am trying to have a Boost Python function return a Python class which is a subclass of a Python builtin class (here str ): 我的第一種方法涉及在 Python 模塊 mys ...
[英]boost-python3 program crashes on exit
在將程序從 boost-python2 移植到 boost-python3 時,我遇到了這樣的情況,即帶有嵌入式 python3 的 boost 程序在退出時崩潰,盡管使用 python 2.7 構建的相同代碼運行良好。 這種情況可以縮小到以下示例 它適用於 python 2.7,但使用 pytho ...
[英]libboost-python create module in C++-runtime and use it from pythin code, for python 3.x
我有一個使用 libboost-python 嵌入 python 的軟件。 它在 C++ 運行時創建一個 python 模塊,然后從 python 代碼中導入它。 對於 python2.7,它的工作原理如下: 測試模塊.py 測試27.cpp 在 Debian Stretch 上,您可以 ...
[英]Using Boost Python 3.10 and C++ Classes
在使用boost::python時,我真的對初始化 C++ 類感到困惑。 使用 CMake 編譯以下代碼時,我沒有收到任何錯誤、警告或其他任何東西: #include <boost/python.hpp> #include <iostream> class Test { ...
[英]Jagged Numpy Arrays in Boost Numpy
我需要在 Python 和 C++ 之間有效地共享數據,並為此使用 Boost Python 和 Boost Numpy。 它適用於“笛卡爾”數組。 對於鋸齒狀數組,我不確定是否可以直接索引。 這是我展示如何從鋸齒狀 numpy 數組中提取第二個數組的示例: 正如預期的那樣: 問題 1:這 ...
[英]Linking python and c++ on windows
我正在嘗試創建一個python庫,用c++編寫,使用boost-python和mingw進行編譯。 c++代碼: 到目前為止,這就是我所做的: python3.9已經安裝安裝mingw/g++ 下載boost zip 運行以下兩個命令: g++ -o middle -m64 -D MS_WIN ...
[英]linking C++ and Python using Boost.Python, on Remote Hosting
首先, pythonanywhere是一個了不起的遠程托管站點,如果它不只是用於python了。 我已經閱讀了大量的解決方案,試圖讓這個簡單的例子工作,試圖使用c++代碼,使用python代碼托管在pythonanywhere中。 c++ 代碼 在我在 pythonanywhere 的帳戶中,我 ...
[英]How to pack boost.python so into a python module
我已經使用boost.python創建了一個 so 文件,並將其導入bash就可以了。 像這樣直接導入但現在我想知道是否可以將其設為常規python 模塊。 這意味着我不想手動將 so 文件及其依賴項放在系統路徑中,或者每次使用時都添加 LD_LIBRARY_PATH 。 有什么方法可以實現嗎? ...
[英]No to_python (by-value) converter found for C++ type: class boost::shared_ptr<class MyCallback>
我想用 Boost.Python 在 c++ 中嵌入 python。 環境: VC++2019 x64 項目 Anaconda 環境 3.6 64 位 mypackage/mymodule.py中的 Python 代碼: C++ 代碼: 我也試過: strErrorMessage將是: N ...
[英]What wrong for I failing call Visual c++ class's method from python
我的環境和版本: 從 Boost 示例/文檔復制的項目代碼: https://www.boost.org/doc/libs/1_77_0/libs/python/doc/html/tutorial/tutorial/exposing.html 步驟總結: 構建 Visual DLL 項目 hello ...
[英]pydoc injecting python submodules content to main module
我有一個模塊dlprim 它的__init__.py包括: 其中._pydlprim是 boost.python 模塊, .netconfig是子模塊。 如果我使用pydoc -w dlprim生成文檔 - 它不包括來自_pydlprim和netconfig.py的類,所以為了生成它們我需要運行py ...
[英]How to install Boost.Python using homebrew (on OSX)?
我正在嘗試在我的 Mac (macOS 11.5.1) 上安裝機器人操作系統 (ROS) Melodic。 在編譯 cv_bridge 包時,編譯器吐出與 Boost.Python 相關的錯誤: ...
[英]Python failing to load boost.python dll
我在使用簡單的提升 python 設置時遇到了一些問題。 我見過很多其他人遇到過問題,但他們似乎都不是和我一樣的問題,因為他們的解決方案都沒有奏效。 作為參考,我在 windows 10 上,使用 mingw64 10.2 作為我的 c++ 編譯器的 msys2 的一部分。 我使用該編譯器構建了 ...
[英]Using Boost Python Numpy ndarray as a Class member variable
我期待將 Python 對象傳遞給 Boost Python Class。 這個 Object 有一個 ndarray 作為屬性,我想把這個 ndarray 作為一個私有成員變量存儲在這個 Class 中,以便以后使用。 我找不到正確的方法來執行此操作,並且在將 boost::python::num ...
[英]Cannot stat 'b2': No such file or directory
I am trying to build boost-python in a virtual machine running Ubuntu 18, following the guide https://www.boost.org/doc/libs/1_76_0/more/getting_star ...
[英]Cannot import some builtin modules from embedded boost python
我正在使用boost::python從我的 C++ 應用程序中運行 python 腳本。 我收到錯誤: ModuleNotFoundError: No module named 'math' 。 一些內置模塊可以工作,但有些則不能。 例如, import sys works。 當我從命令行運行 p ...
[英]How to export Boost::Python module to Go
我沒有工作代碼來顯示 output。 要求是從 Go 代碼中調用此 python 模塊“pylib”。 許多類似的帖子都建議使用 os/exec(pythonpath 中的 declare.so)來調用 pylib 作為外部進程。 如果是這種情況,如何將 <string, object, o ...
[英]Problems passing a std::vector of vector of boost::shared_ptrs from C++ to Python
我在傳回 <std::vector <std::vector <boost::shared_ptr Detection>>> 時遇到問題,我希望有人能幫助我。 I am able to pass the vector of vector but when I t ...
[英]Boost python producer consumer problem (execute boost python thread, std::mutex deadlock)
我正在嘗試創建 boost python 模塊並測試生產者和消費者問題。 但我遇到了一些錯誤和問題...... 下圖顯示了我的目標架構。 我實現了 boost python 模塊這是 python 代碼片段(main.py) 我遇到了兩個問題當“wait_thread_function”首先啟動 ...
[英]Boost python passing named parameter to member class
我有以下結構: 我想在我的 python 模塊中公開它來做一些事情: 但是,當我編譯解釋器並傳遞以下代碼時: 我收到第一個參數的類型錯誤,預期是選項的字典,但是我的 cpp 正在獲得“自我”參考 - 所以 StuffMaker class 作為第一個參數。 基本上這是我的問題,我如何忽略 c++ ...