Question

Get a site running Python 3.5 with Django on Debian

Does anyone know how to do this? Debian ships with 3.4 and I need 3.5 to run the website.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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 --version
Python 3.4.2
python3.5 --version
Python 3.5.2

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

  1. gcc --version

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 build-essential package:

  1. sudo apt-get install -y build-essential

Now download python3.5 source using cURL.

  1. 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:

  1. tar xvf Python-3.5.2.tar.xz
  2. cd Python-3.5.2

Now, we can compile/install it by running following commands:

  1. ./configure
  2. make
  3. 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:

Sample Output
  1. Python 3.5.2 (default, Oct 21 2016, 14:45:38)
  2. [GCC 4.9.2] on linux
  3. 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.