Posts

Showing posts with the label python

uv - python dependency manager

This article explains the essential uv commands to manage python version, python projects and to run python script with dependencies UV Installation and Global Config Install UV using brew on mac brew install uv Install UV using pip pip install uv --upgrade Other installation options https://docs.astral.sh/uv/getting-started/installation View available python versions uv python list List the python version and path used uv python find uv run python --version Install specific versions of python uv python install 3.10 3.12 Uninstall python versions uv python uninstall 3.10 3.12 Pin default global python version uv python pin 3.10 --global Unpin default global python version uv python pin --rm --global Python Project Init a project uv init --vcs none --no-readme Sync a project virutal environment and update the lock file uv sync Sync a project in CI without updating lock file uv sync --locked Pin a python version to project uv python pin 3.10 Unpin a python version from project uv python ...

Creating python virtual environments on Mac OS with pyenv

Using pyenv Install pyenv through homebrew: brew install pyenv List installed versions of python: pyenv versions List available versions of python that can be installed: pyenv install --list Virtual environment for python 3: Install a specific version of python: pyenv install 3.9.0 NOTE for Big Sur (MacOS 11) users: If the install command fails, then try the command as SYSTEM_VERSION_COMPAT=1 pyenv install 3.9.0 Uninstall a version of python: pyenv uninstall 3.9.0 Switch to specific version of python in local terminal window: pyenv local 3.9.0 Switch to specific version of python globally: pyenv global 3.9.0 Switch to specific version of python using environment variable: export PYENV_VERSION=3.9.0 Get pyenv root directory: pyenv root Access the python installation: pyenv exec python --version Create a virtual environment from specific python version: pyenv exec python -m venv .venv Source the virtual environment source .venv/bin/activate Virtual environment for python 2: Install ...