python:: uv 사용법 - venv 가상환경 관리툴

 

uv install

# On Windows.
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
 
# WSL, linux, MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh
 
# for UPDATE
uv self update

 

https://github.com/astral-sh/uv

 

GitHub - astral-sh/uv: An extremely fast Python package and project manager, written in Rust.

An extremely fast Python package and project manager, written in Rust. - astral-sh/uv

github.com

 

uv 사용법

# pip을 포함한 새 가상환경 생성
uv venv --seed
 
# venv
uv venv 
uv venv --python 3.12.2
 
______
# save and install pip dependancy
uv pip freeze > requirements.txt
uv pip install -r requirements.txt
 
# add package
uv pip install flask
uv pip install flask ruff
uv pip install 'ruff>=0.2.0'
 
# upgrade package
uv pip install --upgrade flask
 
 
______
# install python
uv python install 3.12
uv python install 3.10 3.11
 
# fix version
# Pinned `.python-version` to `3.12`
uv python pin 3.12
 
______
# init
uv init example
 
cd example
uv add ruff
uv add ruff --dev  #dev용
 
uv run ruff check
uv run example.py
 
 
# sync
uv pip sync docs/requirements.txt
 
uv lock
uv sync
 
uv pip uninstall requests
uv remove requests

 

https://docs.astral.sh/uv/getting-started/features/#next-steps

 

Features | uv

Introduction Getting started uv provides essential features for Python development — from installing Python and hacking on simple scripts to working on large projects that support multiple Python versions and platforms. uv's interface can be broken down

docs.astral.sh

 

https://docs.astral.sh/uv/reference/cli/#uv-venv

 

Commands | uv

Introduction Reference An extremely fast Python package manager. Usage Commands uv runRun a command or script uv initCreate a new project uv addAdd dependencies to the project uv removeRemove dependencies from the project uv versionRead or update the proje

docs.astral.sh

 

 

https://docs.astral.sh/uv/pip/packages/#installing-packages-from-files

 

Managing packages | uv

Introduction Concepts The pip interface To install a package into the virtual environment, e.g., Flask: To install a package with optional dependencies enabled, e.g., Flask with the "dotenv" extra: $ uv pip install "flask[dotenv]" To install multiple packa

docs.astral.sh

 



댓글 쓰기 · 수정

0 댓글