How to install Flask on Python3 using pip? How to install Flask on Python3 using pip? flask flask

How to install Flask on Python3 using pip?


You seem to have a permission issue. From the log you pasted to pastebin:

error: could not create '/usr/local/lib/python3.4/dist-packages/flask': Permission denied

This is because pip will attempt to install the package globally unless you specify a certain installation location. If you want to install this globally you must use sudo or install as a user with privileges.

Try the following:

sudo pip3 install flask

Or specify to a certain dir:

pip install -t <path> flask

However, with the latter method you will have to always inject the path to sys.modules so I suggest you just use sudo if you can.

Or even more preferrably, use virtualenv. Virtualenv allows you to very easily package your application for production because you can install only the packages you need and you've thus got automatic package isolation. Generating a requirements.txt is then as simple as pip freeze > requirements.txt. Remeber that if you end using a virtualenv, you must not use sudo to install packages as they will then be installed outside the virtualenv.


For Python 3.6.4 version, it is possible to install Flask by doing:

sudo pip3.6 install flask