0% found this document useful (0 votes)
50 views

Getting Started: 1. Set Up A Python Interpreter

The document provides instructions for getting started with a Python tutorial, including installing Anaconda to set up a Python environment, cloning a GitHub repository of Jupyter notebooks containing the tutorial material, and executing code cells within the notebooks. Users are guided on downloading and installing Anaconda for their operating system, using Anaconda to install packages and update environments, and cloning and opening the tutorial notebooks in Jupyter.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Getting Started: 1. Set Up A Python Interpreter

The document provides instructions for getting started with a Python tutorial, including installing Anaconda to set up a Python environment, cloning a GitHub repository of Jupyter notebooks containing the tutorial material, and executing code cells within the notebooks. Users are guided on downloading and installing Anaconda for their operating system, using Anaconda to install packages and update environments, and cloning and opening the tutorial notebooks in Jupyter.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Getting Started

All you need for this tutorial is

a Python 3.5+ Interpreter together with the python packages jupyter, numpy, scipy, pandas and
matplotlib
the material of this tutorial (https://github.com/padas-pub/python-tutorials) in form of jupyter
notebook files (.ipynb)

1. Set up a Python Interpreter

The easiest way to set up a working python environment is by installing Anaconda - a bundle consisting of
the Python interpreter, pre-compiled packages, tools for handling virtual environments, package
management, etc.
1.1 Install Anaconda
Please follow the installation steps according to your operating system.

For Linux users


Click and download the Anaconda installer for Linux. (https://www.anaconda.com/download/).

Choose version 3.5 or higher.

Open your terminal and type the following command

      $ bash ~/Downloads/Anaconda3-4.2.0-Linux-x86_64.sh


Change ~/Downloads with your actual path and Anaconda3-4.2.0-Linux-x86_64.sh with your actual file
name. After installing anaconda successfully run the following command in your terminal:

     export PATH="~/anaconda3/bin:$PATH"

Run in your command line:

     nano ~/.bashrc

Add the following line:

     export PATH=~/anaconda3/bin:$PATH

Save and close the editor.

Finally, close and re-open your terminal so the changes can take effect.

You can check your installation by typing conda "list command" in your terminal. If anaconda is
susccessfully installed this command will display a list of installed packages.

For Windows users


Click and download the Anaconda installer for Windows. (https://www.anaconda.com/download/)

Choose version 3.5 or higher.

Double click the Anaconda installer and follow the prompts.

You can check your installation by typing conda "list command" in your Command Prompt. If anaconda is
successfully installed this command will display a list of installed packages.

For OS X users
Click and download the Anaconda installer for OS X. (https://www.anaconda.com/download/)

Download the command line installer for Anaconda with Python 3.5 or higher.

Run the following command line:

      $ bash ~/Downloads/Anaconda3-4.2.0-MacOSX-x86_64.sh

Change ~/Downloads with your actual path and Anaconda3-4.2.0-MacOSX-x86_64.sh with your actual file
name.
If your installation is successfull , the message “Installation finished.” will be displayed.
1.2 Use Anaconda

Launch Anaconda
You can run anaconda navigator via the following command line:

      $ anaconda-navigator

You can run the jupyter notebook via the following command line:

      $ jupyter notebook

Install package
To install a package, open your terminal window and type the following command to install for example the
"atlas" package:

      $ conda update conda

      $ conda install atlas


Or you can launch the Anaconda Navigator with the command line:

      $ anaconda-navigator

The graphic interface of anaconda navigator will appear. Go to the environments in the left side and choose
not installed and you will get this interface.

Check any package you want, hit apply which will appear in the bottom and then accept the installation of
the new package.

Update package
To update a package, open your terminal window and type the following command to update for example
the "atlas" package:

      $ conda update conda

      $ conda update atlas

Or you can launch the Anaconda Navigator with the command line:
      $ anaconda-navigator

The graphic interface of anaconda navigator will appear. Go to the environments in the left side and you will
get this interface. Click on the blue arrow corresponding to the chosen package and then hit apply which is
in the bottom and then hit ok.

1.3 Install Anaconda Environment


You can extract the list of installed packages via this command line:

      $ conda list -e > req.txt

You can install the environment requirement file

      $ conda create -n new environment --file req.txt

1.4 Reference
http://docs.anaconda.com/anaconda/install/ (http://docs.anaconda.com/anaconda/install/)

2. Clone Repository

Install git

For Linux users

Use this command to download git in case you don't have it on your system

      $ apt-get install git

For Windows users

Download git program from this website (http://msysgit.github.io).

Install the downloaded program.

For OS X

Download the graphic installer from this link (http://sourceforge.net/projects/git-osx-installer/)


Clone git repository

For Windows users

Create a Git bash with a right click on the mouse

Run the following command in the git terminal to clone the python-tutorials repository:

      $ git clone https://github.com/padas-pub/python-tutorials.git

For Linux and OS X users

Run the following command in the git terminal in order to clone the python-tutorials repository:

      $ git clone https://github.com/padas-pub/python-tutorials.git

3. Execute Python code in Jupyter noteboks

Navigate to your local python-tutorials folder and run jupyter notebook via this command:

      $ jupyter notebook

Then a browser window should open, showing the content of your local python-tutorials folder.

In order to execute a cell in a jupyter notebook, just hit Shift + Enter or Ctrl + Enter.

You might also like