You can install it from source.
Installing from source have one drawback though. It is being called
python3.5 instead of
python3. So when you call from terminal
python3 it will still open 3.4.2 one. But if you call
python3.5 it will open Python 3.5.
python3.5 could be linked (changed) to
python3 but it can break system as it’s not know does all Debian packages works with 3.5.
First thing you need to do is to make sure you have C compiler. It’s called
gcc and when you type
you should see something like:
Sample Output - gcc –version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you don’t have installed make sure you have
- sudo apt-get install -y build-essential
Now download python3.5 source using cURL.
- curl -O https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
This is link for Linux source of Python3.5.2. It is latest version in time of typing this answer and it can be changed over time, but you can check for latest version on Python Downloads page.
Unpack it after download and go to unpacked directory:
- tar xvf Python-3.5.2.tar.xz
- cd Python-3.5.2
Now, we can compile/install it by running following commands:
- make install
In short lines
./configure will make sure you have all dependencies and create Makefile so it can be compiled.
make will compile it and
make install will install compiled version of it.
It will take some time to finish (for me it was about 10 minutes).
When you run
python3.5 you will see:
- Python 3.5.2 (default, Oct 21 2016, 14:45:38)
- [GCC 4.9.2] on linux
- Type "help", "copyright", "credits" or "license" for more information.
This should be it. If you really want to link python3.5 over python3, we can try to find solution for it, but this is something I would NOT recommend.