-
Clone this repository.
-
Navigate this repository.
cd Python_PracticeFirst, why uv? when you run a single python script and you need only specific packages are need to run this script not all of your scripts need those modules or packages. Then, uv here to save your time and package management. It also helpful in project management. Comparatively, it is way faster than pip command. A great feature of uv is that, it not requires virtual environment for script files. Moreover, it automatically creates virtualenv for your python project.
pip3 install uvwindows:
pip install uvFor newer file which not include those lines:
# /// script
# requires-python = ">=3.12"
# dependencies = ["requests", "pandas", "bs4", "prettytable"]
# ///uv init --script filename --python < your installed python version >This will some comment top of your file.
# /// script
# requires-python = ">=3.12"
# dependencies = []
# ///Now you can add package name in dependencies list or run command like this:
uv add --script filename "package_name"Also, you can directly type package name in dependencies list. The uv read those lines before he execute the python script and install those packages for you.
You can use different python version of for your own needs:
- Listing available python version
uv python list- Install different python version:
uv python install < version_number >If your using pip for managing the packages so you can use this methods:
Setup Python Virtual Environment (Linux)sudo apt install python3-virtualenvCreate Virtual Environment
virtualenv -p /usr/bin/python3 envActivate virtual environment
source env/bin/activatefor deactivation
deactivateInstall required Libraries
pip3 install -r requirement.txtSetup Python Virtual Environment (Windows)
Create Virtual Environment
python -m venv envActivate virtual environment
.\env\Scripts\activatefor deactivation
deactivate- Create virual env:
python -m venv env- Activate
env\Scripts\activate- deactivate
deactivateInstall required Libraries
pip install -r requirement.txt