1UPDATE
2
3Thanks to Don Kirkby who highlight that there is a new recommended PPA.
4The updated one is ppa:deadsnakes/ppa, so the complete command is the following:
5
6sudo add-apt-repository ppa:deadsnakes/ppa
7If you are using Ubuntu, you can install it adding a PPA; so you can proceed in this way:
8
9sudo add-apt-repository ppa:fkrull/deadsnakes
10sudo apt-get update
11sudo apt-get install python3.5
12If this procedure doesn't work, is possible that your Ubuntu version not supported it. So i think that you can install in this way:
13
14sudo apt-get install libssl-dev openssl
15wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
16tar xzvf Python-3.5.0.tgz
17cd Python-3.5.0
18./configure
19make
20sudo make install