8. Installing Python, an IDE and packages#

Installing Python#

To install Python on your local machine, you can either download the installer from the official website or install conda, which is a version manager for Python and other programming languages (like R).

Installing packages#

To use Python, you will sooner or later need packages. Python offers two main package managers: conda and pip. The installation of conda was described above, and pip is included automatically with every Python installation.

There are packages that can only be installed with either conda or pip, so it can be helpful to be able to use both. However, if you want to focus on just one at first, we recommend pip. Pip should cover about 95% of use cases.

To install packages with either package manager, you first need to open a terminal. In Anaconda Navigator, go to the “Environments” tab, click on the Python environment you just created, then click the green arrow directly to the right and select “Open Terminal” in the window that appears. This will open a terminal where you can type commands.

1) Using pip#

To install a package using pip, you can simply open a terminal, type the following command and press enter:

pip install package_name

where package_name is the name of the package that you would like to install. For example, to install the package numpy, you can type

pip install numpy

2) Using conda#

To install a package using conda, you can simply open a terminal and type

conda install package_name

where package_name is the name of the package that you would like to install. For example, to install the package numpy, you can type

conda install numpy

Installing an IDE#

An IDE (Integrated Development Environment) is a software that provides you with a graphical user interface to write and run your code. There are many different IDEs available for Python, but we recommend using either Jupyter Notebook or PyCharm. These can be installed manually or with the help of Anaconda Navigator, which comes with the installation of Anaconda distribution (not with miniconda though). To install them via Anaconda Navigator, just open said Navigator and as soon as it has started, you should see a list of programs that it supports. When you are at that screen, you can simply choose which IDE to install. If you are not using Anaconda Navigator, you can follow these steps: