How to use uWSGI with python3.6 in Ubuntu/Debian

Step-by-step how-to to use uWSGI with python3.6 for Ubuntu 16.10/17.04 and Debian 9.

Updated on 2018-02-22 with Debian instruction.

Setup

$ sudo apt install \
> python3.6 python3.6-dev uwsgi uwsgi-src uuid-dev libcap-dev libpcre3-dev
$ cd ~
$ export PYTHON=python3.6
$ uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python36"
$ sudo mv python36_plugin.so /usr/lib/uwsgi/plugins/python36_plugin.so
$ sudo chmod 644 /usr/lib/uwsgi/plugins/python36_plugin.so

Test

Ubuntu 16.10

$ uwsgi --plugin python36 -s :0
...
Python version: 3.6.0b2 (default, ...) [GCC 6.2.0 ...]
...

Ubuntu 17.04

$ uwsgi --plugin python36 -s :0 
...
Python version: 3.6.1 (default, ...) [GCC 6.3.0 ...]
...

Debian 9

Installing Python 3.6 in Debian 9 (Stretch) with this guide guide.

$ uwsgi --plugin python36 -s :0 
...
Python version: 3.6.3 (default, ...) [GCC 6.3.0 ...]
...

Originally posted on dev.to/pauloxnet

 2017-04-04 ·   1 min read  ·   HowTo ·    #uwsgi, #python, #devops, #ubuntu