File size: 2,664 Bytes
fb93b05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
chcp 65001 > NUL

@REM https://github.com/Zuntan03/EasyBertVits2 γ‚ˆγ‚ŠεΌ•η”¨γƒ»ζ”Ήε€‰

@echo off
set PS_CMD=PowerShell -Version 5.1 -ExecutionPolicy Bypass
set CURL_CMD=C:\Windows\System32\curl.exe

if not exist %CURL_CMD% (
	echo [ERROR] %CURL_CMD% γŒθ¦‹γ€γ‹γ‚ŠγΎγ›γ‚“γ€‚
	pause & exit /b 1
)

if "%1" neq "" (
	set PYTHON_DIR=%~dp0%~1
) else (
	set PYTHON_DIR=%~dp0python
)
set PYTHON_CMD=%PYTHON_DIR%\python.exe

if "%2" neq "" (
	set VENV_DIR=%~dp0%~2
) else (
	set VENV_DIR=%~dp0venv
)

echo PS_CMD: %PS_CMD%
echo CURL_CMD: %CURL_CMD%
echo PYTHON_CMD: %PYTHON_CMD%
echo VENV_DIR: %VENV_DIR%

if not exist %PYTHON_DIR%\ (
	echo https://www.python.org/
	echo %CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip
	%CURL_CMD% -o python.zip https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

	echo %PS_CMD% Expand-Archive -Path python.zip -DestinationPath %PYTHON_DIR%
	%PS_CMD% Expand-Archive -Path python.zip -DestinationPath %PYTHON_DIR%
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

	echo del python.zip
	del python.zip
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

	echo %PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }"
	%PS_CMD% "&{(Get-Content '%PYTHON_DIR%/python310._pth') -creplace '#import site', 'import site' | Set-Content '%PYTHON_DIR%/python310._pth' }"
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

	echo https://github.com/pypa/get-pip
	echo %CURL_CMD% -o %PYTHON_DIR%\get-pip.py https://bootstrap.pypa.io/get-pip.py
	%CURL_CMD% -o %PYTHON_DIR%\get-pip.py https://bootstrap.pypa.io/get-pip.py
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

	echo %PYTHON_CMD% %PYTHON_DIR%\get-pip.py --no-warn-script-location
	%PYTHON_CMD% %PYTHON_DIR%\get-pip.py --no-warn-script-location
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

	echo %PYTHON_CMD% -m pip install virtualenv --no-warn-script-location
	%PYTHON_CMD% -m pip install virtualenv --no-warn-script-location
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
)

if not exist %VENV_DIR%\ (
	echo %PYTHON_CMD% -m virtualenv --copies %VENV_DIR%
	%PYTHON_CMD% -m virtualenv --copies %VENV_DIR%
	if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )
)

echo call %VENV_DIR%\Scripts\activate.bat
call %VENV_DIR%\Scripts\activate.bat
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )

echo python -m pip install --upgrade pip
python -m pip install --upgrade pip
if %errorlevel% neq 0 ( pause & exit /b %errorlevel% )