Set up Python and libraries on your computer

Business Benefits

Set up your computer ready for building automated tasks, extracting data and constructing visualizations.

Download and install the Anaconda executable file for your operating system and choose default options to install the software.

Anaconda also includes Jupyter Book that can be used to write and execute Python code.

Open the terminal (MacOS) or command prompt window (Windows) and check the Python install version by typing: python --version

If the version is 2.7 as default, update it to 3.x:

  1. Check where your anaconda3 is installed, and if it is installed for the local user only or all users.
  2. If Anaconda is installed for the local user only, enter: ls -l /usr/local/bin/python*ln -s -f /usr/local/bin/python3.8 /usr/local/bin/python
  3. If Anaconda is installed for all users, enter: ln -s -f /opt/anaconda3/bin/python3.8 /usr/local/bin/python

Create a virtual environment for Python using pipenv --python 3.8 or python3 -m venv tutorial-env. You can launch the virtual environment with pipenv shell.

Virtual environment is a virtual machine that can be created on your computer. It acts as a temporary machine for experimenting with code and executing scripts. A virtual environment can be deleted after use and doesn’t affect the normal use of your computer; code and code libraries run only inside the virtual environment.

Install the common libraries like Matplotlib, Numpy and Pandas using pip install commands.

Libraries and predefined functions can be called from your Python code. You can use them to perform mathematical functions, build data frames or display charts and graphs.

  • Matplotlib: type pip install --upgrade matplotlib
  • Numpy: type pip install --upgrade numpy
  • Pandas: type pip install --upgrade pandas

Install and set up Atom or Visual Studio Code for writing code and executing scripts.

Atom is preferred by Mac users and Visual Studio Code by Windows users. They are the most common editors used to write code in Python and can also be used to execute the code within the built-in terminal.

To install Atom:

  1. Go to, download the executable file, and install it on your computer.
  2. Install Terminal package in Atom so that it can open a terminal window: select Packages from the menu, search for platformio-ide-terminal, and click Install.
  3. Once installed, set the default path to launch Terminal within Atom as the default terminal window.
  4. On Windows, navigate to PCs : Settings / Shell Override: and set it to C:WINDOWSSystem32cmd.exe.

To install Visual Studio, go to, download the executable file, and install it on your computer.

Set up a virtual environment within Atom/Visual Studio Code editors by opening the terminal, creating a directory for your training, activating python in a virtual environment, and installing libraries.

To create a directory for your training, enter:

mkdir cxl-training
cd cxl-training
cxl-training pipenv --python /opt/anaconda3/bin/python3.8

`````(Note: `/opt/anaconda3/bin/python3.8` is the path where Python 3.8 was installed earlier)

To activate Python in the cxl-training virtual environment, enter:

> pipenv shell

```You will see the virtual environment name displayed before the prompt: (cxl-training) ?  cxl-training >>
Install libraries with these commands:

pip install --upgrade matplotlib
pip install --upgrade numpy
pip install --upgrade pandas

Find out more information about Python and resources by visiting their websites and documentation pages.