Step 2
Libraries
Install the Python libraries you need for numerical work, plotting, and notebooks.
Install common packages
After Python is installed, use pip to install packages from a terminal or a Jupyter Notebook cell. The python -m pip style keeps pip tied to the Python environment you are using.
Windows
Use py -m pip in Windows PowerShell. First, upgrade pip; this also confirms that pip is connected to the Python environment you are using.
py -m pip install --upgrade pip
Then install multiple common libraries in one command. For example, install NumPy, Matplotlib, and Pandas like this:
py -m pip install numpy matplotlib pandas
macOS / Linux
Use python3 -m pip in a macOS or Linux terminal. First, upgrade pip; this also confirms that pip is connected to the Python environment you are using.
python3 -m pip install --upgrade pip
On some Linux distributions, the system Python may block direct pip upgrades. In that case, continue from a virtual environment instead.
Then install multiple common libraries in one command. For example, install NumPy, Matplotlib, and Pandas like this:
python3 -m pip install numpy matplotlib pandas
Jupyter Notebook
If this is a clean Python setup, install Jupyter Notebook and the Python kernel from a terminal first. ipykernel connects the installed Python environment to notebook cells.
Windows
In Windows PowerShell, install Jupyter Notebook and ipykernel into the Python environment you want to use as the notebook kernel.
py -m pip install notebook ipykernel
macOS / Linux
In a macOS or Linux terminal, install Jupyter Notebook and ipykernel into the Python environment you want to use as the notebook kernel.
python3 -m pip install notebook ipykernel
Install packages
After opening a notebook, use %pip inside a Jupyter Notebook cell. %pip installs packages into the Python environment used by the current notebook kernel.
%pip install numpy matplotlib pandas
This is for notebook cells only. In a .py file, use installed packages with import, such as import numpy as np.