I want to have a script for Windows users to install Python, run python -m venv env
and pip install -r requirements.txt
and python manage.py runserver
.
Installing Python is the part I'm really unsure about.
I want to have a script for Windows users to install Python, run python -m venv env
and pip install -r requirements.txt
and python manage.py runserver
.
Installing Python is the part I'm really unsure about.
You can run python installer in the background via simple command.
Example: (For reference see this.)
python-installer.exe /quiet InstallAllUsers=1 PrependPath=1
If you also want to download the python installer you can use curl
. (It is available on Windows 10 version 1803 or later. See here.)
If you want to have everything inside one .bat script, you also want to refresh system environmental variables after the installation process. Via script like this. So you can simply use python
and pip
. Or you can just use absolute paths.
Example script would look like:
@echo off
rem --Download python installer
curl "https://www.python.org/ftp/python/3.9.4/python-3.9.4-amd64.exe" -o python-installer.exe
rem --Install python
python-installer.exe /quiet InstallAllUsers=1 PrependPath=1
rem --Refresh Environmental Variables
call RefreshEnv.cmd
rem --Use python, pip
python -m venv env
pip install -r requirements.txt
python manage.py runserver
pause