Version 6 (modified by wouter, 21 months ago) ( diff )

--

PyRunner

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
Note: See TracWiki for help on using the wiki.