3 ms·
How do you determine where the venv is? AFAIK, uv run in script mode creates the venv in some random temporary directory.
by maleldil 2y ago
How do you determine where the venv is? AFAIK, uv run in script mode creates the venv in some random temporary directory.
- JimDabell 2y agoI don’t know of a convenient way of doing it, but a clumsy way of doing it is to run this in your script: import os print(os.environ['VIRTUAL_ENV'] + '/bin/python') Then, e.g. in VS Code, you bring up the command palette, run Python: Select Interpreter, and enter the result.
- JimDabell 2y agouv v0.6.10 has just been released with a more convenient way of doing this: uv python find --script foo.py — https://github.com/astral-sh/uv/releases/tag/0.6.10 https://github.com/astral-sh/uv/releases/tag/0.6.10 — https://docs.astral.sh/uv/reference/cli/#uv-python-find--script https://docs.astral.sh/uv/reference/cli/#uv-python-find--scr...