Chapter 08
Which Python runs your code? Interpreters, sys.path and the project .venv
The same file can run on a different Python depending on where you start it, and then `import` finds a different package. Learn to ask which Python is running, how `sys.path` and `uv run` decide, and how to point VS Code and Jupyter at the project's `.venv`.
30 minPython 3.12
How do you want to learn?
Pro course
Python for AI Career is a Pro course
The same file can run on a different Python depending on where you start it, and then `import` finds a different package. Learn to ask which Python is running, how `sys.path` and `uv run` decide, and how to point VS Code and Jupyter at the project's `.venv`.
The Python course is free and complete — this course is not made of anything taken out of it. Every chapter of a Pro course runs the full six steps:
- Encounter — Meet the problem before the definition — what cannot be done without this.
- Understand — Build the mental model: what Python actually does, and why this way.
- Worked — A complete example with its real output — run, not imagined.
- Predict — Say what happens before running it. A wrong prediction teaches more than a right one.
- Apply — Write it and run it on your own machine. Reading it is not the same as doing it.
- Stretch — Ten questions from easy to hard. The last ones are difficult on purpose.