Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPython from Java?

I need to call CPython code from Java. What tools/APIs/libraries exist out there to help me do this?

Jython is not an option since the Python code is heavily dependent upon numpy.

edit 1: The main() function should be Java, not Python (i.e. I need to embed CPython into Java, not vice versa.)

edit 2: I should also mention that I'll be passing large numeric arrays between Java and Python and therefore a solution that brings the two into the same process space would be preferable (but not mandatory.)

like image 764
NPE Avatar asked Jun 27 '26 17:06

NPE


1 Answers

You can take a look at using Jepp to embed CPython into Java. Read documentation here.

edit: For windows the project has prebuilt binaries for Python 2.4, 2.5, and 2.6. For Linux/Unix systems, you have to build it yourself.

like image 160
逆さま Avatar answered Jun 30 '26 05:06

逆さま



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!