Adding scripts to create and start a python virtual environment with jpype1 etc installed

This commit is contained in:
jlizier 2022-09-06 10:27:38 +10:00
parent 348587ee59
commit 8bc6d87d9b
2 changed files with 87 additions and 0 deletions

53
demos/python/create_env.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
##
## Java Information Dynamics Toolkit (JIDT)
## Copyright (C) 2022, Joseph T. Lizier
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Create a python environment (stored in folder $folder) with jpype1, numpy and scipy installed
# Name of folder to use and python commands
folder=jpype_env
pythonCmd=python3
pipCmd=pip3
# Create a python environment (stored in folder ) with jpype1 installed
$pythonCmd -m venv $folder
# enter the environment
source $folder/bin/activate
echo "Python environment started and activated"
# install jpype1, numpy and scipy (does not matter if they are already installed)
$pipCmd install jpype1
$pipCmd install numpy
echo
echo "Jpype1 and numpy installed - you have a functional installation."
echo
echo "Now trying scipy matplotlib, but they are optional..."
echo
$pipCmd install scipy
$pipCmd install matplotlib
echo
echo "Scipy matplotlib installed"
echo
deactivate

34
demos/python/start_env.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
##
## Java Information Dynamics Toolkit (JIDT)
## Copyright (C) 2022, Joseph T. Lizier
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Start the python environment (stored in folder $folder) with jpype1, numpy and scipy installed
# Name of folder to use and python commands
folder=jpype_env
# enter the environment
source $folder/bin/activate
echo
echo "Make sure you called this script as: source start_env.sh"
echo
echo "If you called it like that, you will have your python environment activated."
echo "If you just called ./start_env.sh go back and run again as above"
echo