This repository provides two batch scripts designed to simplify the creation and management of Python virtual environments on your system. With these scripts, you can quickly set up a new Python environment with just a few clicks, streamlining your development workflow.
A script that detects installed Python versions, allows custom naming of your virtual environment, offers an option to upgrade pip, and automatically places you inside the newly created environment.
- Download and Place the Script: Download
venv_create.bat
and place it in your desired directory. - Run the Script: Double-click the script to execute. It will display available Python versions for selection. The default selection is
1
. - Name Your Environment: Enter a name for your virtual environment when prompted. The default name is
venv
. - Upgrade pip (Optional): Choose whether to upgrade pip. The default option is
Yes
. - Install requirements.txt (Optional): Choose whether to run a
pip install -r requirements.txt
command in your new venv. The default option isYes
. - Access Your Environment: Upon completion, the script places you inside the virtual environment and creates an
activate_venv
script for re-entry in the future.
venv_create.mp4
A streamlined version of the script for quick setup, skipping Python version selection and focusing on creating a virtual environment directly.
- Download and Place the Script: Obtain
venv_create_simple.bat
and place it in the target directory. - Run the Script: Execute the script. You will be prompted to name your virtual environment, with a default option provided.
- Access Your Environment: The script will finalize the environment creation and provide an
activate_venv
script for easy access in the future.
To specify a Python version, edit line 10 of venv_create_simple.bat
with your desired version.
In this folder there are a few .bat-files.
The idea is to make these accessible to any CLI window, so that you can more quickly and easily install requirements.txt and pytorch from a cached location.
- Open Environment Variables: Open your start menu and type
environment variables
. Select theEdit the system environment variables
shortcut` - Environment Variables: Click on the
Environment Variables
-button at the bottom right corner of the window. - System variables > Path: In the bottom half of the screen (System variables), scroll down the list until you see a
Path
entry. Select this and press theEdit...
-button. - Add new environment variable: Press the New-button at the top right corner to add a new path variable.
- Enter the path to the envpath folder: Paste the path to the /envpath/-folder from this github project on your local drive and press OK on all windows to save
Any time you want to install a requirements.txt-file, all you can instead run one of the .bat-scripts for this.
-
Type
req
to run the command:pip install -r requirements.txt
-
Type
uvreq
to do the same as req but install it withuv
, which installs it faster. -
Type
torch
to run thetorchinstall.py
script, which will check which version of CUDA you have installed, and then install pytorch with CUDA support. It caches the pytorch and reuses the cache for fast installations in the future. -
Type
uvtorch
to do the same as torch but install it withuv
, which installs it faster.
uvtorch.mp4
By utilizing these scripts, developers can efficiently manage their Python environments, enhancing productivity and focusing more on development tasks.