https://github.com/kalwalt/pybind-test
A simple example with pybind and numpy with C++ code
https://github.com/kalwalt/pybind-test
cplusplus numpy pybind11 python
Last synced: about 1 month ago
JSON representation
A simple example with pybind and numpy with C++ code
- Host: GitHub
- URL: https://github.com/kalwalt/pybind-test
- Owner: kalwalt
- Created: 2025-02-17T17:01:13.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-02-17T17:29:25.000Z (12 months ago)
- Last Synced: 2025-02-17T18:27:01.253Z (12 months ago)
- Topics: cplusplus, numpy, pybind11, python
- Language: C++
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pybind11 example with numpy
This is a simple example of how to use [pybind11](https://github.com/pybind/pybind11) to create Python bindings for C++ code with numpy arrays.
## Prerequisites
You need to have the following installed on your system:
- Python 3
- numpy
- pybind11
You can install numpy and pybind11 using pip:
```bash
pip install numpy pybind11
```
Alternatively, you can install numpy and pybind11 using conda:
```bash
conda install numpy pybind11
```
## Building the project
To build the project run the following commands:
```bash
python setup.py build_ext --inplace
```
then run the example:
```bash
python example.py
```