This chapter dives into the world of Python distributions the various ways you can
actually run Python code. Pythons popularity means flexibility in execution environments,
encompassing both traditional installations and no-install options.
Traditional Installation: CPython Beyond
The default, and most common, distribution is CPython, implemented in C. However, Python isnt
limited to C You also have Jython written in Java and IronPython written in C#, expanding Pythons
reach to different platforms. A standard CPython installation, accessible by downloading directly
from python.orghttps://www.python.org/, bundles three key components:
Python Interpreter: The core engine that executes your Python code.
IDLE: An Integrated Development and Learning Environment GUI offering both interactive
and script modes.
pip: The package manager, crucial for installing and managing external libraries.
Running Python: Interactive vs. Script Mode
There are two fundamental ways to execute your code. Interactive modedemonstrated by typing
python in the command lineis perfect for quick testing. Its a REPL Read-Eval-Print Loop: you type
a command, Python reads it, evaluates it, prints the output, and then loops back for the next
command. Think of it like a calculator: 5 + 5 directly yields 10, and 24569874 * 23598 will give the
result instantly. You can even use printhello to display text.
Script mode involves writing a sequence of commands in a file e.g., hello.py and letting the
interpreter execute the entire script. You can use IDLE for this, writing code in a new file and saving
it with a .py extension, or explore other IDEs like Visual Studio Code, PyCharm, and Spyder.
Beyond the Default: Anaconda Google Colab
The video then highlights powerful alternatives:
Anaconda: A distribution pre-loaded with numerous scientific libraries, making it ideal for
data science and machine learning. It introduces Jupyter Notebooks, a web-based
interactive environment fantastic for learning and experimentation. Jupyter Notebooks use
cells that can be run individually, making it easy to test and iterate. They feature features like
adding, deleting, shifting and running cells. Crucially, Anaconda does not require internet
access to run Jupyter.
Google Colab: A completely no-install option. It provides a Jupyter Notebook environment
accessible directly through your web browser, eliminating the need for local installation. Its
demonstrated with a quick 5 + 5 example, again yielding 10.
Visual Studio Code: A Popular IDE
For more robust development, the video showcases Visual Studio Code VS Code, a widely-used
IDE in the industry. After installation, create a folder and a hello.py file containing printhello. You can
then run the script using the terminal with the command python hello.py.
Key Takeaway:
The beauty of Python lies in its versatility. Whether you prefer a standard installation, a data science
powerhouse like Anaconda, a cloud-based solution like Google Colab, or a professional IDE like VS
Code, theres a Python environment perfectly suited to your needs. Dont hesitate to explore these
options and find what works best for you
actually run Python code. Pythons popularity means flexibility in execution environments,
encompassing both traditional installations and no-install options.
Traditional Installation: CPython Beyond
The default, and most common, distribution is CPython, implemented in C. However, Python isnt
limited to C You also have Jython written in Java and IronPython written in C#, expanding Pythons
reach to different platforms. A standard CPython installation, accessible by downloading directly
from python.orghttps://www.python.org/, bundles three key components:
Python Interpreter: The core engine that executes your Python code.
IDLE: An Integrated Development and Learning Environment GUI offering both interactive
and script modes.
pip: The package manager, crucial for installing and managing external libraries.
Running Python: Interactive vs. Script Mode
There are two fundamental ways to execute your code. Interactive modedemonstrated by typing
python in the command lineis perfect for quick testing. Its a REPL Read-Eval-Print Loop: you type
a command, Python reads it, evaluates it, prints the output, and then loops back for the next
command. Think of it like a calculator: 5 + 5 directly yields 10, and 24569874 * 23598 will give the
result instantly. You can even use printhello to display text.
Script mode involves writing a sequence of commands in a file e.g., hello.py and letting the
interpreter execute the entire script. You can use IDLE for this, writing code in a new file and saving
it with a .py extension, or explore other IDEs like Visual Studio Code, PyCharm, and Spyder.
Beyond the Default: Anaconda Google Colab
The video then highlights powerful alternatives:
Anaconda: A distribution pre-loaded with numerous scientific libraries, making it ideal for
data science and machine learning. It introduces Jupyter Notebooks, a web-based
interactive environment fantastic for learning and experimentation. Jupyter Notebooks use
cells that can be run individually, making it easy to test and iterate. They feature features like
adding, deleting, shifting and running cells. Crucially, Anaconda does not require internet
access to run Jupyter.
Google Colab: A completely no-install option. It provides a Jupyter Notebook environment
accessible directly through your web browser, eliminating the need for local installation. Its
demonstrated with a quick 5 + 5 example, again yielding 10.
Visual Studio Code: A Popular IDE
For more robust development, the video showcases Visual Studio Code VS Code, a widely-used
IDE in the industry. After installation, create a folder and a hello.py file containing printhello. You can
then run the script using the terminal with the command python hello.py.
Key Takeaway:
The beauty of Python lies in its versatility. Whether you prefer a standard installation, a data science
powerhouse like Anaconda, a cloud-based solution like Google Colab, or a professional IDE like VS
Code, theres a Python environment perfectly suited to your needs. Dont hesitate to explore these
options and find what works best for you