Guide: Installing Python 3.x
,
2 February 2018
DoCSoc Education: Python
Hi Everyone!
Before our first session this Monday, there's a few things we'd like you to install on your laptops, so we can get started right away on the day:
Python version 3.x (we recommend 3.6 or 3.7, but anything starting with a 3 will do). See below for installation.
A text editor. We recommend one of the following below:
- Visual Studio Code
- Sublime Text (not free)
Installing Python 3.x on Windows
Windows doesn't come with Python by default, but you can download the installer here. Click on the "Windows x86-64 executable installer" option or just download directly from here. Then, simply open the installer and follow the instructions (just like installing any other program on Windows!).
To check that we've successfully installed Python, open up a Powershell. To do this, you can simply search for "Windows Powershell" in the start menu. Alternatively,press window
(the key between Ctrl and Alt) and r
to open a 'Run' prompt and type in 'powershell' and press enter. Type in the following exactly and hit enter:
python3 --version
And if it says something amongst the lines of 'Python 3.x', you're done!
Installing Python 3.x on MacOS
By default, Macs come with Python already. However, this is Python 2.7, which was released 8 years ago, and not the version that we want to use today. But worry not, for installing a new version of python is easy peasy!
We're going to need to open a terminal. You can do this by either opening your applications folder and simply double clicking it, or you can open up Spotlight by holding command
and spacebar
, typing in "terminal" and press enter. To learn more about using a terminal on a mac, see here
First, we need to install Homebrew - this is a package manager (kind of like an app store) that we're going to use to install Python 3.6. Simply copy and paste the following (all on one line) into the terminal and press enter:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You'll then have to enter your password and press enter. Homebrew should now be installed.
Now, all that's left to do is install Python 3 - to do this, enter the following into your terminal and press enter. You may have to enter your password again.
brew install python3
Voilà! You should now have python 3 installed on your system. Just to check, run the following inside the terminal:
python3 --version
You should see something amongst the lines of Python 3.x
. Keep in mind that this doesn't overwrite your existing Pyhton 2.7 install, so if you write python
instead of python3
, you'll be running that version of Python instead.
Installing Python 3.x on Linux
If you're already on linux, chances are you're a pro and either already have Python installed or can figure it out on your own :D
Help! I'm having difficulties!
If you're really struggling, don't worry. There'll be plenty of mentors from DoC to help you troubleshoot. Just let us know at the beginning of the session.