Packages and Virtual Environments
Almost every AI project starts the same way: you install a package that someone else wrote. In this lesson you will learn what a package is and how pip gets one. You will also learn why each project needs its own virtual environment. Last, you will see where API keys belong, and where they must never go.
New words
- Package
- Code that other people wrote and shared for you to use.
- pip
- The tool that downloads packages and installs them.
- Virtual environment
- A separate folder with its own packages for one project.
- requirements.txt
- A text file that lists the packages a project needs.
- Pinning
- Fixing a package to one exact version, like numpy==1.26.4.
- API key
- A secret code for your account, like a UPI PIN.
- Environment variable
- A named value kept outside your code, such as a key.
What you will learn
- Why this matters for AI work
- What is a package?
- Installing with pip
- The problem: one shared shelf
- The venv workflow
- requirements.txt: sharing your setup
- Try it: two projects, one computer
- Keep out of Git, and other tools
- Where to keep API keys
- Common mistakes
- Explain it to a friend
- Key takeaways
10 quiz questions at the end.
The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.