setupvars: Updated notifications, fixed calling python in Windows case (#2319)

This commit is contained in:
Artyom Anokhov 2020-09-17 21:20:12 +03:00 committed by GitHub
parent 2a9ec98d13
commit fecce756a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View File

@ -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
)

View File

@ -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