Setup for Lesson
Text Editor
A text editor is the piece of software you use to view and write code. If you have a preferred text editor, please use it. Suggestions for text editors are, Notepad++ (Windows), TextEdit (macOS), Gedit (GNU/Linux), GNU Nano, Vim. Alternatively, there are IDE’s (integrated developer environments) that have more features specifically for coding such as VS Code; there are also IDEs specific to languages will be listed in the appropriate section(s) below.
Python Setup
IDEs: PyCharm, Spyder, VS Code
We use Python 3*. The “Anaconda3” package provides everything Python-related you will need for the workshop. To install Anaconda, follow the instructions below.
Some old research projects may be in Python 2 but Python 2 has been retired and new projects should be in Python 3.
Windows
Download the latest Anaconda Windows installer. Double-click the installer and follow the instructions. When asked “Add Anaconda to my PATH environment variable”, answer “yes”. It will warn you not to, but it’s required for it to be found by git bash After it’s finished, close and reopen any open terminals to reload the updated PATH and allow the installed Python to be found.
Once the Anaconda installation is finished you will be asked if you want the installer to initialize Anaconda3 by running conda init? You should select yes. Alternatively/additionally you will need to run the following command in GitBash
conda init bash
Then close and reopen GitBash.
Please test the python install open GitBash (or your favorite terminal) and run the following command to verify that the installation was successful.
cd ~
python
You can then type the following to exit:
quit()
In some cases GitBash will hang on this command and not launch the Python interpreter.
In this case close and reopen git bash and issue the following commands:
cd ~
echo 'alias python="winpty python.exe"' >> .bashrc
source .bashrc
python
Mac OS X
Mac OS Intel
Download the latest Anaconda Mac OS X installer. Double-click the .pkg file and follow the instructions.
Mac OS M1
If you have a M1 Mac you need a specific version of Anaconda follow the link below.
Once the Anaconda installation is finished you will be asked if you want the installer to initialize Anaconda3 by running conda init? You should select yes.
Linux
Download the latest Anaconda Linux Installer.
Install via the terminal like this (you will need to change the version number to the latest version):
First move to the folder where you downloaded the installer, this is likely to be the Downloads folder e.g.
$ cd ~/Downloads
$ bash Anaconda3-2021.11-Linux-x86_64.sh
Answer ‘yes’ to allow the installer to initialize Anaconda3 in your .bashrc.
Download Data for Python Lesson
Now we are ready to download the code that we need for this lesson. Open a terminal on your machine, and enter:
$ cd
$ git clone https://github.com/Southampton-RSG-Training/python-novice
cd
will move to your home directory, and git clone
will download a copy of the materials.