Debian Jessie does not come with the correct Python version out of the box, and instead comes with Python 2. To be able to install Python 3(.5), we have a few options. We could build and install from source, but as per Debian's website, we shouldn't do this. Instead, we will use pyenv, a tool that allows users to switch Python versions easily without breaking their system.
To install pyenv, we will use the official installer.
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
Using pyenv, we can install specific Python versions. pyenv will build these from source using python-build, but won't install them in a way that overwrites the system's version.
pyenv install 3.5.2
If you have issues with this, or you need another Python version, you can see available versions by running pyenv install --list
.
Now we've installed the correct version, setting the version of Python we wish to use system-wide is as simple as running this command:
pyenv global 3.5.2
To test that this worked, try running the command python --version
on your system to confirm the version being used.
You should have now installed Python 3.5 on Debian Jessie.
For some reason, I also had to
to get this to work. Source: pyenv README "git checkout" instructions
Doesn't make a lot of sense to me, but I thought I'd post it here in case it helps someone else. Prior to doing that, the path was not set up correctly and I still had the system-wide
python
binary.