python-venv-tutorial/
├── README.md # Main tutorial content
├── GITHUB_SETUP.md # Instructions for uploading to GitHub
├── requirements.txt # Example dependencies file
├── .gitignore # Git ignore file
└── examples/ # Example scripts
├── hello_world.py # Basic script example
├── fetch_data.py # Package usage example
└── dependencies.py # Environment info example
# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activate# Run the first example
python examples/hello_world.py
# Run the environment info example
python examples/dependencies.py
# Install requests and run the second example
pip install requests
python examples/fetch_data.pypip list
pip freezedeactivateComplete tutorial covering:
- What virtual environments are
- How to create and activate them
- Installing and managing packages
- Best practices
- Troubleshooting
Three example Python scripts:
- hello_world.py: Simple greeting script
- fetch_data.py: Shows how to use external packages
- dependencies.py: Displays environment information
Template file showing how to track dependencies.
Ensures virtual environments and cache files aren't uploaded to Git.
- Read the Tutorial: Open README.md for the full guide
- Follow GITHUB_SETUP.md: Instructions to upload to GitHub
- Run the Examples: Try each example script
- Create Your Own: Use this as a template for your projects
- Beginner: Read README.md intro sections
- Intermediate: Try all examples in the examples/ folder
- Advanced: Set up real projects with requirements.txt
- Expert: Share on GitHub and collaborate with others
Happy Learning! 🐍