How to configure Claude Code to use virtual environments

1 · Python Developer Tooling Handbook – pydevtools.com · July 31, 2026, 6:10 p.m.
Summary
This blog post discusses how to configure Claude Code to properly use virtual environments in Python projects, providing several configuration patterns to overcome issues related to the stateless nature of Claude's shell invocation. It explains why traditional activation of virtual environments does not persist across tool calls and outlines methods like using `uv run`, `.claude/settings.json`, and PreToolUse hooks to ensure the correct environment is utilized throughout the development process.