error: Python.h: No such file or directory

When install dlib python module, i get error

This is because missing python3-dev package. To fix, install

If you are using python virtualenv, you will need to recreate the virtualenv after installing dev package.

ERROR: Failed building wheel for mysqlclient

When install mysqlclient python module, i get error

Fixed by installing

pip install mysqlclient mysql_config: not found

On Ubuntu 18.04, when i install mysqlclient python module, i get error

this is fixed by installing libmysqlclient-dev

  • ERROR: Failed building wheel for mysqlclient
  • See Python

    Running Python Application with gunicorn and nginx

    Create a service file for gunicorn


    /home/ubuntu/myapp/wagtail2 = path to the folder where web application is.

    /home/ubuntu/myapp/venv/bin/gunicorn = is where gunicorn installed inside virtualenv.

    Change these path as required.

    Restart gunicorn with

    use following nginx config

    Restart nginx

    pycharm python editor

    Installing PyCharm Community Edition on Ubuntu

    PyCharm Community Edition is a free python editor from JetBrains. You can download it from

    Download and extact the tar.gz file. Move it to a folder like

    Execute sartup script

    Once pycharm started, you can go to Tools menu and create a startup script.

    pycharm python editor


    Getting started with Django Framework

    Django is a python framework for developing web applications. To install Django, run

    To create a project, run

    Django come with built in development server. To start Django development server, change to the project folder and run

    django framework

    It will start a development web server on url

    Creating App

    A django project consists of multiple apps. Apps do a specific task, can be considered as a module. To create an app, run

    To activate the app, you need to edit file


    this list all installed apps, you need to add name of your app to end of the list.


    Running Web Server with python SimpleHTTPServer

    SimpleHTTPServer is a python module that allow you to run web server for static files.

    To start web server, run

    This will start a web server on port 8000.

    You will be able to access server in URL

    To stop server, press CTRL + C

    To get SimpleHTTPServer run on differnt port, run

    This will run SimpleHTTPServer on port 80.

    Python 3

    Python 3 comes with bult in module http.server, to use it, run

    If you want to run on differnt port, specify port number


    Creating and using virtualenv

    To create a virtualenv, run


    On Ubuntu 18, this command will create virtualenv with Python 2.7.

    To create virtualenv with Python 3, run

    Here “venv” is my virtualenv name.

    python3 virtualenv

    To activate virtialenv, go to the folder where your virtialenv folder is present, then run

    You will see name of your virtualenv on the command promt. To exit out of virtualenv, run

    This can be run from any folder.


    Install virtualenv on Ubuntu
    Creating and using virtualenv

    virtualenv is used to create isolated python environments.

    Install virtualenv with setuptools

    Create a folder

    Create virtualenv

    Activate virtualenv

    To exit a virtualenv, run