1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#!/bin/bash test_install() { IMPORT_NAME="$1" PIP_NAME="$2" /usr/bin/python3 <<EOF import sys try: import ${IMPORT_NAME} except ImportError: sys.exit(1) sys.exit(0) EOF if [ $? -ne 0 ]; then # if not, install scikit-learn echo "Installing ${PIP_NAME}..." /usr/bin/pip3 install ${PIP_NAME} fi } test_install sklearn scikit-learn test_install path path.py /usr/share/LithoGraphX/post_install.sh |