How to install Python 3.4.5 from apt?

As you can see from http://packages.ubuntu.com/search?keywords=python3.4&searchon=names&suite=xenial&section=all, there is no package for python3.4 for Ubuntu 16.04. You can compile and install Python 3.4 from source, but if you are not familiar with doing it or prefer to install packages using the APT package manager, I would recommend installing it from a well-known PPA that provides a variety of versions of Python for many Ubuntu versions.

  1. Add the deadsnakes PPA (read more about it at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa):

    sudo add-apt-repository ppa:deadsnakes/ppa
    
  2. Install python3.4:

    sudo apt-get update
    sudo apt-get install python3.4
    

According to https://askubuntu.com/a/682875/15003,/usr/bin/python3 should still be symlinked to /usr/bin/python3.5. Therefore, if you want to call Python 3.4, you would need to type the full path to it, which is /usr/bin/python3.4. To avoid accidentally breaking other programs, I strongly recommend you to not change the symlink that /usr/bin/python3 points to and instead just use /usr/bin/python3.4 whenever you need to call Python 3.4.

Alternatively, a popular method to manage multiple versions of Python, which I personally recommend, is to use virtualenv. You can read more about it at https://virtualenv.pypa.io/en/stable/; further elaboration of it in this post seems too far off the intent of the question.