Created
January 6, 2025 11:14
-
-
Save arkon108/0c42b519a7b901dcc04b46a957d6c828 to your computer and use it in GitHub Desktop.
Initialize new Python project with uv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install uv | |
# see https://github.com/astral-sh/uv | |
pip install uv | |
# verify uv works | |
uv --version | |
# navigate to your project | |
cs ~/my-project | |
# create virtual environment for your project | |
uv venv .venv | |
# alternatively, to create env with specific Python version | |
uv venv --python 3.12 | |
# use a specific python version in existing venv, creates .python-version | |
uv python pin 3.12 | |
# activate virtual environment | |
source .vent/bin/activate | |
# verify no packages are installed for the virtual env | |
uv pip list | |
# install packages in venv (with environment activated) | |
uv pip install <package name> | |
# exit the venv | |
deactivate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment