Version 7 (modified by 21 months ago) ( diff ) | ,
---|
PyRunner
PyRunner is a tool to run Python code from Java. The PyRunner takes a ready-to-use python tar.gz file that was generated using the setuptool in python. This file contains all dependencies. The PyRunner then creates a virtual environment, and installs your tar.gz file and all dependencies in the virtual environment.
Preparing Python
This is a tool to run python code from Java. The tool requires FULL python to be installed, including pip and venv.
Some python installations require manual post-installation of these. To do this you need something like
sudo apt-get update sudo apt install python3-pip sudo apt install python3.<VERSION>-venv
where <VERSION> is 8,9 etc depending on your python version.
To check whether your python is ready for use, run this command
python -m venv venv
If you get any errors, check the error and do further installations. Unfortunately this seems the python way of getting a working installation.
Usage
The PythonVenv usage is roughly like this:
- create a PythonVenv E, possibly already with the targz code you want to run
- Pass your targz directly into the PythonVenv constructor
- or if you dont have a targz, copy the code into E.
- E.call the code you want to run
- call E.remove to remove the venv