diff --git a/scripts/setupvars/setupvars.bat b/scripts/setupvars/setupvars.bat index a8e31c5f599..bfe84310b6e 100644 --- a/scripts/setupvars/setupvars.bat +++ b/scripts/setupvars/setupvars.bat @@ -50,14 +50,14 @@ set "ngraph_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\ngraph\cmake" ) :: Check if Python is installed -python3 --version 2>NUL +python --version 2>NUL if errorlevel 1 ( - echo Error^: Python is not installed. Please install Python 3.6 or higher ^(64-bit^) from https://www.python.org/downloads/ + echo Error^: Python is not installed. Please install one of Python 3.6 - 3.8 ^(64-bit^) from https://www.python.org/downloads/ exit /B 1 ) :: Check Python version -for /F "tokens=* USEBACKQ" %%F IN (`python3 --version 2^>^&1`) DO ( +for /F "tokens=* USEBACKQ" %%F IN (`python --version 2^>^&1`) DO ( set version=%%F ) @@ -73,12 +73,12 @@ if "%Major%" geq "3" ( ) if not "%python_ver%"=="okay" ( - echo Unsupported Python version. Please install Python 3.6 or higher ^(64-bit^) from https://www.python.org/downloads/ + echo Unsupported Python version. Please install one of Python 3.6 - 3.8 ^(64-bit^) from https://www.python.org/downloads/ exit /B 1 ) :: Check Python bitness -python3 -c "import sys; print(64 if sys.maxsize > 2**32 else 32)" 2 > NUL +python -c "import sys; print(64 if sys.maxsize > 2**32 else 32)" 2 > NUL if errorlevel 1 ( echo Error^: Error during installed Python bitness detection exit /B 1 @@ -89,7 +89,7 @@ for /F "tokens=* USEBACKQ" %%F IN (`python -c "import sys; print(64 if sys.maxsi ) if not "%bitness%"=="64" ( - echo Unsupported Python bitness. Please install Python 3.6 or higher ^(64-bit^) from https://www.python.org/downloads/ + echo Unsupported Python bitness. Please install one of Python 3.6 - 3.8 ^(64-bit^) from https://www.python.org/downloads/ exit /B 1 ) diff --git a/scripts/setupvars/setupvars.sh b/scripts/setupvars/setupvars.sh index cd927ef01f1..5a1e6e4a26f 100755 --- a/scripts/setupvars/setupvars.sh +++ b/scripts/setupvars/setupvars.sh @@ -107,17 +107,24 @@ if [ "$python_bitness" != "" ] && [ "$python_bitness" != "64" ] && [ "$OS_NAME" echo "[setupvars.sh] 64 bitness for Python" $python_version "is requred" fi -MINIMUM_REQUIRED_PYTHON_VERSION="3.6" +MINIMUM_REQUIRED_PYTHON_VERSION="3.6" +MAX_SUPPORTED_PYTHON_VERSION=$([[ "$OSTYPE" == "darwin"* ]] && echo '3.7' || echo '3.8') if [[ ! -z "$python_version" && "$(printf '%s\n' "$python_version" "$MINIMUM_REQUIRED_PYTHON_VERSION" | sort -V | head -n 1)" != "$MINIMUM_REQUIRED_PYTHON_VERSION" ]]; then - echo "[setupvars.sh] Unsupported Python version. Please install Python 3.6 or higher (64-bit) from https://www.python.org/downloads/" + echo "[setupvars.sh] ERROR: Unsupported Python version. Please install one of Python 3.6-${MAX_SUPPORTED_PYTHON_VERSION} (64-bit) from https://www.python.org/downloads/" + return 1 fi + if [ ! -z "$python_version" ]; then # add path to OpenCV API for Python 3.x export PYTHONPATH="$INTEL_OPENVINO_DIR/python/python3:$PYTHONPATH" - if [[ -e $INTEL_OPENVINO_DIR/python/python$python_version ]]; then + pydir=$INTEL_OPENVINO_DIR/python/python$python_version + if [[ -d $pydir ]]; then # add path to Inference Engine Python API - export PYTHONPATH="$INTEL_OPENVINO_DIR/python/python$python_version:$PYTHONPATH" + export PYTHONPATH="${pydir}:${PYTHONPATH}" + else + echo "[setupvars.sh] ERROR: Can not find OpenVINO Python module for python${python_version} by path ${pydir}" + return 1 fi fi