Skip to content

Commit

Permalink
Update run.bat
Browse files Browse the repository at this point in the history
For Python2: Check if virtualenv exists before trying to install
  • Loading branch information
soraxas authored May 25, 2018
1 parent e492da6 commit a5ef71e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions run.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@echo off
set PYTHON=python
set VENV_NAME=_echo360venv
set VENV=venv

cd "%~dp0"
:: Check virtual env is installed
Expand All @@ -12,7 +11,11 @@ if %ERRORLEVEL%==0 (
) ELSE (
:: using python 2
set VENV=virtualenv
%PYTHON% -m pip install --user %VENV%
%PYTHON% -c "import %VENV%"
if NOT %ERRORLEVEL%==0 (
echo Installing virtual environment module...
%PYTHON% -m pip install --user %VENV%
)
)

if not exist %VENV_NAME% (
Expand All @@ -24,8 +27,6 @@ if not exist %VENV_NAME% (
echo Try to install pip with admin prelivage?
pause && EXIT /B 1
)
echo Installing virtual environment module...
%PYTHON% -m pip install %VENV%
if NOT %ERRORLEVEL%==0 ( echo Failed to install virtual environment && pause && EXIT /B 1 )
echo Creating python virtual environment in "%VENV_NAME%"...
%PYTHON% -m %VENV% %VENV_NAME%
Expand Down

0 comments on commit a5ef71e

Please sign in to comment.