Getting Started
Install Python, set up virtualenv, and manage packages with pip.
Python is a runtime language that runs on the CPython VM (or alternatives like PyPy). It’s the go-to language for scripting, data science, machine learning, and web back-ends.
Setup
Install macOS:
brew install python
Install Ubuntu:
sudo apt-get install python3 python3-pip
Install Windows: Download from python.org and check “Add Python to PATH” during install.
Version Management
Use pyenv to manage multiple Python versions:
curl https://pyenv.run | bash
pyenv install 3.12.0
pyenv global 3.12.0
Virtual Environments
Always isolate project dependencies:
python -m venv .venv
source .venv/bin/activate # macOS / Linux
.venv\Scripts\activate # Windows
pip
pip is the package manager. Declare dependencies in requirements.txt:
flask==3.0.0
requests>=2.31
Install them:
pip install -r requirements.txt
Next: Basics