How to configure Claude Code to use virtual environments

· 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.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →