Installing Python 3

python 3

The older Python 2.7 is still used by some software, so it may be installed on your system; it is automatically a part of CentOS.  However, we will only use Python 3 in CS 5045, so it is essential that you have Python version 3.4 or 3.6 installed on your development system.  See installation instructions below.

Installation from the python web site

You can always install the latest Python release from the Python Web site.  However, their may be other ways that are easier for your system.  We will just detail the installation for CentOS and MacOS.

installtion on centos

Open a terminal and use these commands

ssh -l root localhost
yum -y update
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum -y install python36u
yum -y install python36u-pip
pip3.6 install --upgrade pip
yum -y install python36u-devel
yum -y install python36u-tools

to install Python version 3.6.5.  Type

python3.6 --version

to verify the installation.

Much of this installation procedure is a simplification of the procedure on this page.

installation on macos

On your Mac, first make sure you have the latest version of the Mac OS X operating system installed.  First, get the Homebrew package manager from this page.  Basically, you open a terminal and cut-and-paste the Ruby command to the command line.  Then, also in the terminal, type these commands

brew install tcl-tk
brew install python --with-tcl-tk

 

to install Python 3.  Type

python3 --version

to verify the installation.  This procedure also installs the convenient Homebrew package manager for MacOS. You can install many useful packages and applications with Homebrew, so it will be worth your time to become familiar with it.

The command for the Idle integrated development environment for Python 3 is

idle3

It should open without a problem.  If there is a warning about tcl-tk, then something went wrong with the installation above.

installation on other LINUX distributions

Many Linux distributions do not yet have a package for Python 3, but some do.  You can check your package manager to determine whether version 3.4 or 3.6 is available for you.  Otherwise, you should look up the installation procedure online.